1
Fork 0

Rollup merge of #133386 - wesleywiser:update_musl_base_crt_default, r=jieyouxu

Update linux_musl base to dynamically link the crt by default

However, don't change the behavior of any existing targets at this time. For targets that used the old default, explicitly set `crt_static_default = true`.

This makes it easier for new targets to use the correct defaults while leaving the changing of individual targets to future PRs.

Related to https://github.com/rust-lang/compiler-team/issues/422
This commit is contained in:
Matthias Krüger 2024-12-14 14:07:56 +01:00 committed by GitHub
commit 1c24da63a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 99 additions and 7 deletions

View file

@ -8,8 +8,5 @@ pub(crate) fn opts() -> TargetOptions {
base.post_link_objects_self_contained = crt_objects::post_musl_self_contained();
base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;
// These targets statically link libc by default
base.crt_static_default = true;
base
}

View file

@ -12,6 +12,9 @@ pub(crate) fn target() -> Target {
| SanitizerSet::MEMORY
| SanitizerSet::THREAD;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "aarch64-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {

View file

@ -22,6 +22,8 @@ pub(crate) fn target() -> Target {
features: "+strict-align,+v6".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base::linux_musl::opts()
},
}

View file

@ -22,6 +22,8 @@ pub(crate) fn target() -> Target {
features: "+strict-align,+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base::linux_musl::opts()
},
}

View file

@ -23,6 +23,8 @@ pub(crate) fn target() -> Target {
max_atomic_width: Some(32),
mcount: "\u{1}mcount".into(),
has_thumb_interworking: true,
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base::linux_musl::opts()
},
}

View file

@ -26,6 +26,8 @@ pub(crate) fn target() -> Target {
features: "+v7,+thumb2,+soft-float,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base::linux_musl::opts()
},
}

View file

@ -25,6 +25,8 @@ pub(crate) fn target() -> Target {
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base::linux_musl::opts()
},
}

View file

@ -4,5 +4,7 @@ pub(crate) fn target() -> Target {
let mut base = super::i686_unknown_linux_musl::target();
base.cpu = "pentium".into();
base.llvm_target = "i586-unknown-linux-musl".into();
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
base
}

View file

@ -6,6 +6,8 @@ pub(crate) fn target() -> Target {
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]);
base.stack_probes = StackProbeType::Inline;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
// implementation, apparently relies on frame pointers existing... somehow.

View file

@ -8,7 +8,6 @@ pub(crate) fn target() -> Target {
base.cpu = "mips64r2".into();
base.features = "+mips64r2,+soft-float".into();
base.max_atomic_width = Some(64);
base.crt_static_default = false;
Target {
// LLVM doesn't recognize "muslabi64" yet.

View file

@ -22,6 +22,8 @@ pub(crate) fn target() -> Target {
abi: "abi64".into(),
endian: Endian::Big,
mcount: "_mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base
},
}

View file

@ -5,6 +5,8 @@ pub(crate) fn target() -> Target {
base.cpu = "mips64r2".into();
base.features = "+mips64r2".into();
base.max_atomic_width = Some(64);
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
// LLVM doesn't recognize "muslabi64" yet.
llvm_target: "mips64el-unknown-linux-musl".into(),

View file

@ -6,7 +6,6 @@ pub(crate) fn target() -> Target {
base.cpu = "mips32r2".into();
base.features = "+mips32r2,+soft-float".into();
base.max_atomic_width = Some(32);
base.crt_static_default = false;
Target {
llvm_target: "mips-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {

View file

@ -5,7 +5,6 @@ pub(crate) fn target() -> Target {
base.cpu = "mips32r2".into();
base.features = "+mips32r2,+soft-float".into();
base.max_atomic_width = Some(32);
base.crt_static_default = false;
Target {
llvm_target: "mipsel-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {

View file

@ -7,6 +7,8 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::Inline;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "powerpc64-unknown-linux-musl".into(),

View file

@ -6,6 +6,8 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::Inline;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "powerpc64le-unknown-linux-musl".into(),

View file

@ -6,6 +6,8 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
base.max_atomic_width = Some(32);
base.stack_probes = StackProbeType::Inline;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "powerpc-unknown-linux-musl".into(),

View file

@ -6,6 +6,8 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
base.max_atomic_width = Some(32);
base.stack_probes = StackProbeType::Inline;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "powerpc-unknown-linux-muslspe".into(),

View file

@ -23,6 +23,8 @@ pub(crate) fn target() -> Target {
llvm_abiname: "ilp32d".into(),
max_atomic_width: Some(32),
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base::linux_musl::opts()
},
}

View file

@ -21,7 +21,6 @@ pub(crate) fn target() -> Target {
llvm_abiname: "lp64d".into(),
max_atomic_width: Some(64),
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
crt_static_default: false,
..base::linux_musl::opts()
},
}

View file

@ -12,6 +12,8 @@ pub(crate) fn target() -> Target {
base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers =
SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::THREAD;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "s390x-unknown-linux-musl".into(),

View file

@ -29,6 +29,8 @@ pub(crate) fn target() -> Target {
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base::linux_musl::opts()
},
}

View file

@ -14,6 +14,8 @@ pub(crate) fn target() -> Target {
| SanitizerSet::MEMORY
| SanitizerSet::THREAD;
base.supports_xray = true;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "x86_64-unknown-linux-musl".into(),