Skip to content
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

UEFI targets fail to compile: "LLVM ERROR: dwo only supported with ELF and Wasm" #101071

Closed
nicholasbishop opened this issue Aug 27, 2022 · 2 comments · Fixed by #101088
Closed
Labels
C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression.

Comments

@nicholasbishop
Copy link
Contributor

nicholasbishop commented Aug 27, 2022

The UEFI targets (x86_64-unknown-uefi, i686-unknown-uefi, and aarch64-unknown-uefi) started failing to compile in the latest nightly when using build-std, failing with "LLVM ERROR: dwo only supported with ELF and Wasm".

Code

src/main:

#![no_main]
#![no_std]

#[panic_handler]
fn panic_handler(_info: &core::panic::PanicInfo) -> ! {
    loop {}
}

#[export_name = "efi_main"]
pub extern "C" fn main(_h: *mut core::ffi::c_void, _st: *mut core::ffi::c_void) -> usize {
    0
}

.cargo/config.toml:

[unstable]
build-std = ["core", "compiler_builtins", "alloc"]
build-std-features = ["compiler-builtins-mem"]

Build:

$ cargo +nightly build --target x86_64-unknown-uefi
   Compiling core v0.0.0 (/var/home/nbishop/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling rustc-std-workspace-core v1.99.0 (/var/home/nbishop/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
LLVM ERROR: dwo only supported with ELF and Wasm
   Compiling compiler_builtins v0.1.79
LLVM ERROR: dwo only supported with ELF and Wasm
error: could not compile `rustc-std-workspace-core`
warning: build failed, waiting for other jobs to finish...
error: could not compile `core`
LLVM ERROR: dwo only supported with ELF and Wasm
error: could not compile `compiler_builtins`

cargo-bisect-rustc output

searched nightlies: from nightly-2022-08-25 to nightly-2022-08-27
regressed nightly: nightly-2022-08-27
searched commit range: 7480389...c07a8b4
regressed commit: 450e99f

bisected with cargo-bisect-rustc v0.6.4

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc -- build --target x86_64-unknown-uefi 

CC @davidtwco since bisect pointed to #98051

@nicholasbishop nicholasbishop added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Aug 27, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Aug 27, 2022
@kennystrawnmusic
Copy link

Can confirm. Definitely needs to be looked into by the team — @phil-opp can you reproduce this?

@nicholasbishop
Copy link
Contributor Author

I see in https://github.com/rust-lang/rust/pull/98051/files#diff-e8d72f87be1eb954600ca7d27ce0fdd7360fe43e393c5bb0d73e226f11abc67d that debuginfo_kind: DebuginfoKind::Pdb is set in windows_msvc_base. I think that needs to be added in https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/uefi_msvc_base.rs, or maybe directly in msvc_base?

I tested this out locally by using a custom target JSON that matches x86_64-unknown-uefi except adds "debuginfo-kind": "pdb", and that seems to fix the bug.

kennystrawnmusic added a commit to kennystrawnmusic/cryptos that referenced this issue Aug 27, 2022
JohnTitor added a commit to JohnTitor/rust that referenced this issue Aug 30, 2022
…davidtwco

Set DebuginfoKind::Pdb in msvc_base

This PDB setting was added to `windows_msvc_base` in
rust-lang#98051. It's also needed for the
UEFI targets, and since `uefi_msvc_base` and `windows_msvc_base` are the
only things that inherit from `msvc_base`, just move the PDB setting up
to `mscv_base` to cover both.

Fixes rust-lang#101071
JohnTitor added a commit to JohnTitor/rust that referenced this issue Aug 30, 2022
…davidtwco

Set DebuginfoKind::Pdb in msvc_base

This PDB setting was added to `windows_msvc_base` in
rust-lang#98051. It's also needed for the
UEFI targets, and since `uefi_msvc_base` and `windows_msvc_base` are the
only things that inherit from `msvc_base`, just move the PDB setting up
to `mscv_base` to cover both.

Fixes rust-lang#101071
@bors bors closed this as completed in 1dd47b0 Aug 31, 2022
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Aug 31, 2022
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 20, 2024
Set DebuginfoKind::Pdb in msvc_base

This PDB setting was added to `windows_msvc_base` in
rust-lang/rust#98051. It's also needed for the
UEFI targets, and since `uefi_msvc_base` and `windows_msvc_base` are the
only things that inherit from `msvc_base`, just move the PDB setting up
to `mscv_base` to cover both.

Fixes rust-lang/rust#101071
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
Set DebuginfoKind::Pdb in msvc_base

This PDB setting was added to `windows_msvc_base` in
rust-lang/rust#98051. It's also needed for the
UEFI targets, and since `uefi_msvc_base` and `windows_msvc_base` are the
only things that inherit from `msvc_base`, just move the PDB setting up
to `mscv_base` to cover both.

Fixes rust-lang/rust#101071
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants