-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Pass +forced-atomics feature for riscv32{i,im,imc}-unknown-none-elf #114499
Conversation
@rustbot label -S-waiting-on-review +S-blocked |
rust-lang/rust#98333 broke RISC-V targets without A-extension. This will be fixed by rust-lang/rust#114497 or rust-lang/rust#114499. ``` = note: rust-lld: error: undefined symbol: __atomic_load_4 >>> referenced by mod.rs:1242 (/rustc/eb088b8b9d98f1af1b0e61bbdcd8686e1b0db7b6/library/core/src/num/mod.rs:1242) >>> compiler_builtins-d066fd6ed508b6b5.compiler_builtins.b1b28d926042a9f7-cgu.004.rcgu.o:(compiler_builtins::mem::memcpy::he6d5500b219c1d3d) in archive /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/riscv32i-unknown-none-elf/lib/libcompiler_builtins-d066fd6ed508b6b5.rlib ```
rust-lang/rust#98333 broke RISC-V targets without A-extension. This will be fixed by rust-lang/rust#114497 or rust-lang/rust#114499. ``` = note: rust-lld: error: undefined symbol: __atomic_load_4 >>> referenced by mod.rs:1242 (/rustc/eb088b8b9d98f1af1b0e61bbdcd8686e1b0db7b6/library/core/src/num/mod.rs:1242) >>> compiler_builtins-d066fd6ed508b6b5.compiler_builtins.b1b28d926042a9f7-cgu.004.rcgu.o:(compiler_builtins::mem::memcpy::he6d5500b219c1d3d) in archive /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/riscv32i-unknown-none-elf/lib/libcompiler_builtins-d066fd6ed508b6b5.rlib ```
rust-lang/rust#98333 broke RISC-V targets without A-extension. This will be fixed by rust-lang/rust#114497 or rust-lang/rust#114499. ``` = note: rust-lld: error: undefined symbol: __atomic_load_4 >>> referenced by uint_macros.rs:1230 (/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/uint_macros.rs:1230) >>> compiler_builtins-a15f77f0f647aa99.compiler_builtins.eedcbccd0d1b9b88-cgu.1.rcgu.o:(compiler_builtins::mem::memcpy::hedd00e0c59d2a943) in archive /home/runner/work/portable-atomic/portable-atomic/target/riscv32im-unknown-none-elf/debug/deps/libcompiler_builtins-a15f77f0f647aa99.rlib ```
4227d24
to
d554090
Compare
d554090
to
b0346d5
Compare
This comment has been minimized.
This comment has been minimized.
Just an FYI the check has moved to
|
Is there a policy defined somewhere? If there isn't, in this case, it might be better to merge this now, as there is no downside to end users that I am aware of. We currently have quite a few issues moving to |
The stuff about riscv, msp430, and avr on that list will be ignored, portable-atomic provides lock-free atomic load/store1 by default for those targets (to be precise: RISC-V with Footnotes
|
☔ The latest upstream changes (presumably #117716) made this pull request unmergeable. Please resolve the merge conflicts. |
@taiki-e @Amanieu what are your thoughts on rebasing and getting this merged in its current state? All toolchains from rustup are shipping with LLVM16, older compilers built with LLVM15 will continue to work (without this feature). The only possible breakage is a custom build of modern rust + LLVM15, and even then that only applies to the riscv32 targets - seems like an unlikely source of breakage, with a huge upside for riscv32 developers. |
ping! Could we merge this? It's causing quite a bit of annoyances in the embedded ecosystem: porting crates to riscv32imc requires doing hacks to polyfill atomic loads/stores that the hardware is already capable of.
|
b0346d5
to
ad5d98a
Compare
Rebased. I would like to merge this if there is no problem with the policy on the minimum LLVM version for these targets, but I'm not a maintainer, so I don't know about that.
No, this causes a regression with LLVM 15 because compiler-builtins (and maybe libcore too) has code that depends on cfg(target_has_atomic_load_store). This is an error that actually occurred when #98333 (already reverted) was merged: taiki-e/semihosting@472e58a |
This comment has been minimized.
This comment has been minimized.
ad5d98a
to
49aa5da
Compare
These commits modify compiler targets. |
#117947 drops llvm 15. |
#117947 has been merged, which unblocks this PR. |
@@ -507,6 +507,8 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str | |||
.features | |||
.split(',') | |||
.filter(|v| !v.is_empty() && backend_feature_name(v).is_some()) | |||
// Drop +forced-atomics feature introduced in LLVM 16. | |||
.filter(|v| *v != "+forced-atomics" || get_version() >= (16, 0, 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be removed, LLVM16 is required now.
It seems to be a docker-related network error (unrelated to this PR's change) |
@bors retry |
Pass +forced-atomics feature for riscv32{i,im,imc}-unknown-none-elf As said in rust-lang#98333 (comment), `forced-atomics` target feature is also needed to enable atomic load/store on these targets (otherwise, libcalls are generated): https://godbolt.org/z/433qeG7vd ~~This PR is currently marked as a draft because:~~ - ~~`forced-atomics` target feature is currently broken (rust-lang#114153 EDIT: Fixed - ~~`forced-atomics` target feature has been added in LLVM 16 (llvm/llvm-project@f5ed0cb), but the current minimum LLVM version [is 15](https://github.com/rust-lang/rust/blob/90f0b24ad3e7fc0dc0e419c9da30d74629cd5736/src/bootstrap/llvm.rs#L557). In LLVM 15, the atomic load/store of these targets generates libcalls anyway.~~ EDIT: LLVM 15 has been dropped Depending on the policy on the minimum LLVM version for these targets, this may be blocked until the minimum LLVM version is increased to 16. r? `@Amanieu`
💔 Test failed - checks-actions |
Still network related by the looks of it :/ |
@bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (c9c760f): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 675.01s -> 672.348s (-0.39%) |
…cs, r=Amanieu Add `+forced-atomics` feature to esp32s2 no_std target Similar to rust-lang#114499 but for the Xtensa backend. The ESP32-S2 doesn't have native atomic support, but can have atomic load/stores as part of the ISA with this LLVM codegen feature. Note: The current rev of LLVM that rustc is using doesn't contain the `+forced-atomics` feature for Xtensa, but I'm pushing this now to remove the patch from our fork in `esp-rs/rust`. r? `@Amanieu` because you reviewed the related RISC-V PR
…cs, r=Amanieu Add `+forced-atomics` feature to esp32s2 no_std target Similar to rust-lang#114499 but for the Xtensa backend. The ESP32-S2 doesn't have native atomic support, but can have atomic load/stores as part of the ISA with this LLVM codegen feature. Note: The current rev of LLVM that rustc is using doesn't contain the `+forced-atomics` feature for Xtensa, but I'm pushing this now to remove the patch from our fork in `esp-rs/rust`. r? ``@Amanieu`` because you reviewed the related RISC-V PR
Rollup merge of rust-lang#133599 - esp-rs:target/esp32s2-forced-atomics, r=Amanieu Add `+forced-atomics` feature to esp32s2 no_std target Similar to rust-lang#114499 but for the Xtensa backend. The ESP32-S2 doesn't have native atomic support, but can have atomic load/stores as part of the ISA with this LLVM codegen feature. Note: The current rev of LLVM that rustc is using doesn't contain the `+forced-atomics` feature for Xtensa, but I'm pushing this now to remove the patch from our fork in `esp-rs/rust`. r? ``@Amanieu`` because you reviewed the related RISC-V PR
As said in #98333 (comment),
forced-atomics
target feature is also needed to enable atomic load/store on these targets (otherwise, libcalls are generated): https://godbolt.org/z/433qeG7vdThis PR is currently marked as a draft because:EDIT: Fixedforced-atomics
target feature is currently broken (Use of RiscV "+forced-atomics" target feature triggers hard-float ABI for symbols.o #114153).EDIT: LLVM 15 has been droppedforced-atomics
target feature has been added in LLVM 16 (llvm/llvm-project@f5ed0cb), but the current minimum LLVM version is 15. In LLVM 15, the atomic load/store of these targets generates libcalls anyway.Depending on the policy on the minimum LLVM version for these targets, this may be blocked until the minimum LLVM version is increased to 16.
r? @Amanieu