-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Undefined symbols when linking i686-unknown-uefi
without using -Zbuild-std
#104326
Comments
@rustbot claim |
It looks like there are two issues here, which I will start working on PRs for. The first issue is that we aren't setting
This mix of formats doesn't cause an error until you actually try to use one of the functions in an ELF object, at which point you'll get a linker error. The second issue relates to compiler_builtins using optimized assembly for some builtins: https://github.com/rust-lang/compiler-builtins/blob/0.1.83/build.rs#L302. When clang compiles these asm files, it doesn't add a Edit: the |
The necessary fixes in compiler_builtins have been made and released in 0.1.84. Next step is #104561 |
…r=Mark-Simulacrum Use clang for the UEFI targets This fixes an issue where the C and asm sources built by compiler_builtins were being compiled as ELF objects instead of PE objects. This wasn't noticed before because it doesn't cause compiler_builtins or rustc to fail to build. You only see a failure when a program is built that references one of the symbols in an ELF object. Compiling with clang fixes this because the cc crate converts the UEFI targets into Windows targets that clang understands, causing it to produce PE objects. Also update compiler_builtins to 0.1.84 to pull in some necessary fixes for compiling the UEFI targets with clang. Fixes rust-lang#104326
Simple repro:
Compile with
cargo build --target i686-unknown-uefi
. This fails with undefined symbols___udivdi3
and___umoddi3
.Full output
Interestingly, the error does not reproduce when using
-Zbuild-std
. Compiling withcargo build --target i686-unknown-uefi -Zbuild-std=core,compiler_builtins
is successful.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: