From 5f1457a56178b99c097c6e60bd058c631f098614 Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Wed, 8 Jul 2020 23:28:16 +0000 Subject: [PATCH] linker: illumos ld does not support --eh-frame-hdr As of rust-lang/rust#73564, the --eh-frame-hdr flag is unconditionally passed to linkers on many platforms. The illumos link editor does not currently support this flag. The linker machinery in the Rust toolchain currently seems to use the (potentially cross-compiled) target to choose linker flags, rather than looking at what might be running on the build system. Disabling the flag for all illumos/Solaris targets seems like the best we can do for now without more serious surgery. --- src/librustc_codegen_ssa/back/linker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 7a07da0d3a65b..e64aafa599fd8 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -619,9 +619,9 @@ impl<'a> Linker for GccLinker<'a> { // Some versions of `gcc` add it implicitly, some (e.g. `musl-gcc`) don't, // so we just always add it. fn add_eh_frame_header(&mut self) { - // The condition here is "uses ELF" basically. if !self.sess.target.target.options.is_like_osx && !self.sess.target.target.options.is_like_windows + && !self.sess.target.target.options.is_like_solaris && self.sess.target.target.target_os != "uefi" { self.linker_arg("--eh-frame-hdr");