mirror of
https://github.com/rui314/mold.git
synced 2026-11-09 04:49:33 -10:00
Build on hosts without 64-bit atomics
std has no AtomicU64 or AtomicI64 on hosts such as 32-bit PowerPC, 32-bit MIPS and pre-v6 ARM, so mold did not compile there, whereas the C++ version fell back to libatomic. Take those two types from portable-atomic, which uses the std types where they exist and falls back to locks elsewhere. Also check the 32-bit PowerPC build in CI; the existing armv7 check did not catch this because armv7 has 64-bit atomics. See https://github.com/rui314/mold/discussions/1643#discussioncomment-18603572.
This commit is contained in:
1 parent
a9c709b8a4
commit
0ea3c18bc1
6 files changed
+20
-5
No files matched your search
@@ -20,10 +20,12 @@ jobs:
|
||||
sudo ./install-test-deps.sh
|
||||
sudo .github/workflows/install-extras.sh
|
||||
- run: cargo build --locked
|
||||
- name: check the build for a 32-bit host
|
||||
- name: check the build for 32-bit hosts
|
||||
run: |
|
||||
rustup target add armv7-unknown-linux-gnueabihf
|
||||
rustup target add armv7-unknown-linux-gnueabihf powerpc-unknown-linux-gnu
|
||||
cargo check --locked --workspace --all-targets --target armv7-unknown-linux-gnueabihf
|
||||
# 32-bit PowerPC has no 64-bit atomics
|
||||
cargo check --locked --workspace --all-targets --target powerpc-unknown-linux-gnu
|
||||
- name: verify all target toolchains are available
|
||||
run: |
|
||||
cargo test --locked -p mold-cli --test integration -- --list |
|
||||
|
||||
Generated
+7
@@ -245,6 +245,7 @@ dependencies = [
|
||||
"libz-sys",
|
||||
"memchr",
|
||||
"memmap2",
|
||||
"portable-atomic",
|
||||
"rayon",
|
||||
"rustc-demangle",
|
||||
"xxhash-rust",
|
||||
@@ -433,6 +434,12 @@ version = "0.3.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.107"
|
||||
|
||||
@@ -36,6 +36,8 @@ libc.workspace = true
|
||||
libz-sys = "1.1.29"
|
||||
memchr = "2.8.3"
|
||||
memmap2 = "0.9"
|
||||
# std has no 64-bit atomics on hosts such as 32-bit PowerPC.
|
||||
portable-atomic = "1"
|
||||
rayon = "1"
|
||||
rustc-demangle = "0.1"
|
||||
xxhash-rust = { version = "0.8", features = ["xxh3"] }
|
||||
|
||||
+2
-1
@@ -65,8 +65,9 @@
|
||||
//! conditions.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use portable_atomic::AtomicU64;
|
||||
use rayon::prelude::*;
|
||||
|
||||
use crate::cmdline::ReportOutput;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
//! Input sections and the records the linker parses out of them.
|
||||
|
||||
use std::fmt::{self, Write};
|
||||
use std::sync::atomic::{AtomicBool, AtomicU8, AtomicU64, Ordering};
|
||||
use std::sync::atomic::{AtomicBool, AtomicU8, Ordering};
|
||||
|
||||
use bstr::BStr;
|
||||
use portable_atomic::AtomicU64;
|
||||
|
||||
use crate::chunks::OutputSectionId;
|
||||
use crate::chunks::merged::{MergedSection, MergedSectionId};
|
||||
|
||||
+3
-1
@@ -2,10 +2,12 @@
|
||||
|
||||
// Counter is used to collect statistics numbers.
|
||||
|
||||
use std::sync::atomic::{AtomicBool, AtomicI64, Ordering};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex, Once};
|
||||
use std::time::Instant;
|
||||
|
||||
use portable_atomic::AtomicI64;
|
||||
|
||||
use crate::out;
|
||||
|
||||
static COUNTERS_ENABLED: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
Reference in new issue
Block a user