Skip to content

armv4t-none-eabi cannot use compiler_fence #140105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
EvansJahja opened this issue Apr 21, 2025 · 3 comments
Open

armv4t-none-eabi cannot use compiler_fence #140105

EvansJahja opened this issue Apr 21, 2025 · 3 comments
Labels
A-atomic Area: Atomics, barriers, and sync primitives A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@EvansJahja
Copy link

I tried this code:

target: armv4t-none-eabi

compiler_fence(core::sync::atomic::Ordering::Acquire);

I expected to see this happen: compile successfully

Instead, this happened: rust-lld: error: undefined symbol: __sync_synchronize

Meta

rustc --version --verbose:

rustc 1.88.0-nightly (b8c54d635 2025-04-20)
binary: rustc
commit-hash: b8c54d6358926028ac2fab1ec2b8665c70edb1c0
commit-date: 2025-04-20
host: x86_64-pc-windows-msvc
release: 1.88.0-nightly
LLVM version: 20.1.2
Backtrace

   Compiling armv4t-none-eabi-rust-issues v0.1.0 (C:\Users\EvansGrace02\Documents\Workspace\armv4t-none-eabi-rust-issues)
error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "C:\\Users\\EVANSG~1\\AppData\\Local\\Temp\\rustcua9ZTt\\symbols.o" "<2 object files omitted>" "--as-needed" "-Bstatic" "C:\\Users\\EvansGrace02\\Documents\\Workspace\\armv4t-none-eabi-rust-issues\\target\\armv4t-none-eabi\\debug\\deps/{librustc_std_workspace_core-84d0d8d460275600.rlib,libcore-d30cc2520e72557b.rlib,libcompiler_builtins-b57c6847551ab611.rlib}.rlib" "-L" "C:\\Users\\EVANSG~1\\AppData\\Local\\Temp\\rustcua9ZTt\\raw-dylibs" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-o" "C:\\Users\\EvansGrace02\\Documents\\Workspace\\armv4t-none-eabi-rust-issues\\target\\armv4t-none-eabi\\debug\\deps\\armv4t_none_eabi_rust_issues-b850b252791fe0bb" "--gc-sections" "-Tlink.x"        
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: undefined symbol: __sync_synchronize␍
          >>> referenced by atomic.rs:4162 (C:\Users\EvansGrace02\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\sync\atomic.rs:4162)␍
          >>>               C:\Users\EvansGrace02\Documents\Workspace\armv4t-none-eabi-rust-issues\target\armv4t-none-eabi\debug\deps\armv4t_none_eabi_rust_issues-b850b252791fe0bb.5j6rvadtm3yiwcqowkfzw4jgj.1tjialn.rcgu.o:(core::sync::atomic::compiler_fence::h9d169d71a0fb354a)␍
          >>> referenced by atomic.rs:4161 (C:\Users\EvansGrace02\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\sync\atomic.rs:4161)␍
          >>>               C:\Users\EvansGrace02\Documents\Workspace\armv4t-none-eabi-rust-issues\target\armv4t-none-eabi\debug\deps\armv4t_none_eabi_rust_issues-b850b252791fe0bb.5j6rvadtm3yiwcqowkfzw4jgj.1tjialn.rcgu.o:(core::sync::atomic::compiler_fence::h9d169d71a0fb354a)␍
          >>> referenced by atomic.rs:4163 (C:\Users\EvansGrace02\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\sync\atomic.rs:4163)␍
          >>>               C:\Users\EvansGrace02\Documents\Workspace\armv4t-none-eabi-rust-issues\target\armv4t-none-eabi\debug\deps\armv4t_none_eabi_rust_issues-b850b252791fe0bb.5j6rvadtm3yiwcqowkfzw4jgj.1tjialn.rcgu.o:(core::sync::atomic::compiler_fence::h9d169d71a0fb354a)␍
          >>> referenced 1 more times␍

@EvansJahja EvansJahja added the C-bug Category: This is a bug. label Apr 21, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 21, 2025
@EvansJahja
Copy link
Author

minimal repo

@EvansJahja
Copy link
Author

related: #140059

There's a workaround

and it does work. It's just that the produced assembly looks like this, despite promising to be compile time only

Image

@hanna-kruppe
Copy link
Contributor

cc #62256

@jieyouxu jieyouxu added O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-codegen Area: Code generation A-atomic Area: Atomics, barriers, and sync primitives A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-atomic Area: Atomics, barriers, and sync primitives A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants