-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use clang for the UEFI targets #104622
Use clang for the UEFI targets #104622
Conversation
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. Note that this requires compiler_builtins >= 0.1.84. Fixes rust-lang#104326
(rustbot has picked a reviewer for you, use r? to override) |
Hm, is there a chance we can add a test verifying we produce PE objects somewhere? It might be hard given tier 2 status, but I think we have some existing infrastructure for testing e.g. asm for arbitrary targets that we might be able to reuse. |
Are you thinking of a test that does something like |
Sure, if that works that seems quite workable. I think putting that in rustbuild itself as part of the dist step for example is obviously a hack but would be fine in practice. |
This syncs it with how the UEFI targets are built in dist-various-2.
f1aaf48
to
eb2e60d
Compare
If clang isn't the C compiler used for the UEFI targets, or if the wrong `--target` is passed to clang, we will get ELF objects in some rlibs. This will cause problems at link time when trying to compile a UEFI program that uses any of those objects. Add a check to the dist step for UEFI targets that reads each rlib with the `object` crate and fails with an error if any non-COFF objects are found.
eb2e60d
to
6054608
Compare
OK, I've now added a check to |
@bors r+ rollup=iffy |
…earth Rollup of 7 pull requests Successful merges: - rust-lang#83608 (Add slice methods for indexing via an array of indices.) - rust-lang#95583 (Deprecate the unstable `ptr_to_from_bits` feature) - rust-lang#101655 (Make the Box one-liner more descriptive) - rust-lang#102207 (Constify remaining `Layout` methods) - rust-lang#103193 (mark sys_common::once::generic::Once::new const-stable) - rust-lang#104622 (Use clang for the UEFI targets) - rust-lang#104638 (Move macro_rules diagnostics to diagnostics module) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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 #104326