Skip to content

Use --eh-frame-hdr on linux-musl target & ld.lld linker flavour #73483

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/librustc_target/spec/linux_musl_base.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::spec::crt_objects::{self, CrtObjectsFallback};
use crate::spec::{LinkerFlavor, TargetOptions};
use crate::spec::{LinkerFlavor, LldFlavor, TargetOptions};

pub fn opts() -> TargetOptions {
let mut base = super::linux_base::opts();
Expand All @@ -8,7 +8,11 @@ pub fn opts() -> TargetOptions {
// `GNU_EH_FRAME` program header to executables generated, which is required
// when unwinding to locate the unwinding information. I'm not sure why this
// argument is *not* necessary for normal builds, but it can't hurt!
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,--eh-frame-hdr".to_string());
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-Wl,--eh-frame-hdr".to_string());
base.pre_link_args
.entry(LinkerFlavor::Lld(LldFlavor::Ld))
.or_default()
.push("--eh-frame-hdr".to_string());

base.pre_link_objects_fallback = crt_objects::pre_musl_fallback();
base.post_link_objects_fallback = crt_objects::post_musl_fallback();
Expand Down