Skip to content

Commit 4fff320

Browse files
authored
Rollup merge of #136791 - nicholasbishop:bishop-disable-dwarf, r=jieyouxu
Disable DWARF in linker options for i686-unknown-uefi This fixes an lld warning: > warning: linker stderr: rust-lld: section name .debug_frame is longer than 8 characters and will use a non-standard string table See https://reviews.llvm.org/D69594 for details of where the warning was added. This warning only occurs with the i686 UEFI target, not x86_64 or aarch64. The x86_64 target uses an LLVM target of `x86_64-unknown-windows` and aarch64 uses `aarch64-unknown-windows`, but i686 uses `i686-unknown-windows-gnu` (note the `-gnu`). See comments in `i686_unknown_uefi.rs` for details of why. The `.debug_frame` section should not actually be needed; UEFI targets provide a separate PDB file for debugging. Disable DWARF (and by extension the `.debug_frame` section) by passing `/DEBUG:NODWARF` to lld. Tested with: ``` export RUSTC_LOG=rustc_codegen_ssa::back::link=info cargo +stage1 build --release --target i686-unknown-uefi ``` This issue was originally raised here: #119286 (comment). See also #136096. It was suggested to file an LLVM bug, but I don't think LLVM is actually doing anything wrong as such. CC `@dvdhrm` `@jyn514` let me know if you have any feedback on this approach
2 parents 277dda4 + 9da96a6 commit 4fff320

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// The cdecl ABI is used. It differs from the stdcall or fastcall ABI.
66
// "i686-unknown-windows" is used to get the minimal subset of windows-specific features.
77

8-
use crate::spec::{RustcAbi, Target, base};
8+
use crate::spec::{LinkerFlavor, Lld, RustcAbi, Target, add_link_args, base};
99

1010
pub(crate) fn target() -> Target {
1111
let mut base = base::uefi_msvc::opts();
@@ -24,6 +24,13 @@ pub(crate) fn target() -> Target {
2424
base.features = "-mmx,-sse,+soft-float".into();
2525
base.rustc_abi = Some(RustcAbi::X86Softfloat);
2626

27+
// Turn off DWARF. This fixes an lld warning, "section name .debug_frame is longer than 8
28+
// characters and will use a non-standard string table". That section will not be created if
29+
// DWARF is disabled.
30+
//
31+
// This is only needed in the i686 target due to using the `-gnu` LLVM target (see below).
32+
add_link_args(&mut base.post_link_args, LinkerFlavor::Msvc(Lld::No), &["/DEBUG:NODWARF"]);
33+
2734
// Use -GNU here, because of the reason below:
2835
// Background and Problem:
2936
// If we use i686-unknown-windows, the LLVM IA32 MSVC generates compiler intrinsic

0 commit comments

Comments
 (0)