-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Can't use vmsr
instruction in global_asm!
on armv7r-none-eabihf
without codegen-units=1
#127269
Comments
The same issue happens with $ cargo build --release
Compiling qemu-armv7r v0.1.0 (/Users/chrisnc/src/armv7r-issues)
error: <inline asm>:7:5: instruction requires the following: 'A' (Atomic Instructions)
lr.w t0, 0(t1)
^ |
minimized: #![no_std]
core::arch::global_asm!(
r#"
.section .text.startup
.global _start
.code 32
.align 0
_start:
vmsr fpexc, r0
"#
); works: 'rustc --edition=2021 --crate-type lib --target armv7r-none-eabihf repro.rs -C opt-level=0 -C embed-bitcode=no' so both |
I have a half-baked (read: totally uninformed goose chase) that LLVM might not be properly copying the target features when creating the TargetMachine codegen. Following this down:
The last one says:
But: rust/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp Lines 405 to 530 in c872a14
doesn't do the copying. I'm trying to hunt down where in LLVM this copy would actually take place, in the createTargetMachine code. |
@Dirbaio tried leaking the feature flags, so it's probably not the "llvm doesn't copy the data right" thing I was guessing. Leaving the breadcrumbs in case it's useful for anyone following the codegen process down. |
This is possibly a dupe of #80608 |
i've narrowed it to this line. If that runs, compilation fails.
so it's LTO-related, yep. Seems similar to #80608 though the compilation does abort here. Probably root cause is llvm/llvm-project#61991 too. |
narrowed it down to https://github.com/rust-lang/llvm-project/blob/96aca7c51701f9b3c5dd8567fcddf29492008e6d/llvm/lib/Object/ModuleSymbolTable.cpp#L96 the target features string there is empty. If I hardcode it to "+vfp3d16" the error goes away, that confirms the issue is there. |
As in #80608 (comment), the workaround is to add assembly directives in the |
The problem was this bug in rust/llvm - rust-lang/rust#127269 Also fix the git version not updating when the common is not rebuilt by setting it to rebuild upon git head changing
The problem was this bug in rust/llvm - rust-lang/rust#127269 - Fix the git version not updating when the common is not rebuilt by setting it to rebuild upon git head changing. - Delete .cargo/config.toml and replace it with build script to make it simpler - Move the config.txt output to the artifacts folder
See https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/armv7r-unknown-none-eabihf.20weirdness/near/448803070 for discussion and https://github.com/ferrous-systems/armv7r-issues for a reproducer.
I tried this code:
In debug profile, this compiles OK. If you use release profile and force codegen-units=1, it compiles. On armv8r-unknown-none-eabihf, it compiles.
But, if the target is armv7r-unknown-none-eabihf and codegen-units != 1, you get this error:
Meta
rustc --version --verbose
:or
Both have the same issue.
The text was updated successfully, but these errors were encountered: