Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1c24da6

Browse files
authored
Rollup merge of rust-lang#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 rust-lang/compiler-team#422
2 parents f96fdab + 3f3ee2d commit 1c24da6

24 files changed

+99
-7
lines changed

compiler/rustc_target/src/spec/base/linux_musl.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,5 @@ pub(crate) fn opts() -> TargetOptions {
88
base.post_link_objects_self_contained = crt_objects::post_musl_self_contained();
99
base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;
1010

11-
// These targets statically link libc by default
12-
base.crt_static_default = true;
13-
1411
base
1512
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub(crate) fn target() -> Target {
1212
| SanitizerSet::MEMORY
1313
| SanitizerSet::THREAD;
1414

15+
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
16+
base.crt_static_default = true;
17+
1518
Target {
1619
llvm_target: "aarch64-unknown-linux-musl".into(),
1720
metadata: crate::spec::TargetMetadata {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub(crate) fn target() -> Target {
2222
features: "+strict-align,+v6".into(),
2323
max_atomic_width: Some(64),
2424
mcount: "\u{1}mcount".into(),
25+
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
26+
crt_static_default: true,
2527
..base::linux_musl::opts()
2628
},
2729
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub(crate) fn target() -> Target {
2222
features: "+strict-align,+v6,+vfp2,-d32".into(),
2323
max_atomic_width: Some(64),
2424
mcount: "\u{1}mcount".into(),
25+
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
26+
crt_static_default: true,
2527
..base::linux_musl::opts()
2628
},
2729
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ pub(crate) fn target() -> Target {
2323
max_atomic_width: Some(32),
2424
mcount: "\u{1}mcount".into(),
2525
has_thumb_interworking: true,
26+
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
27+
crt_static_default: true,
2628
..base::linux_musl::opts()
2729
},
2830
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ pub(crate) fn target() -> Target {
2626
features: "+v7,+thumb2,+soft-float,-neon".into(),
2727
max_atomic_width: Some(64),
2828
mcount: "\u{1}mcount".into(),
29+
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
30+
crt_static_default: true,
2931
..base::linux_musl::opts()
3032
},
3133
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub(crate) fn target() -> Target {
2525
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
2626
max_atomic_width: Some(64),
2727
mcount: "\u{1}mcount".into(),
28+
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
29+
crt_static_default: true,
2830
..base::linux_musl::opts()
2931
},
3032
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ pub(crate) fn target() -> Target {
44
let mut base = super::i686_unknown_linux_musl::target();
55
base.cpu = "pentium".into();
66
base.llvm_target = "i586-unknown-linux-musl".into();
7+
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
8+
base.crt_static_default = true;
79
base
810
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ pub(crate) fn target() -> Target {
66
base.max_atomic_width = Some(64);
77
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]);
88
base.stack_probes = StackProbeType::Inline;
9+
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
10+
base.crt_static_default = true;
911

1012
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
1113
// implementation, apparently relies on frame pointers existing... somehow.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub(crate) fn target() -> Target {
88
base.cpu = "mips64r2".into();
99
base.features = "+mips64r2,+soft-float".into();
1010
base.max_atomic_width = Some(64);
11-
base.crt_static_default = false;
1211

1312
Target {
1413
// LLVM doesn't recognize "muslabi64" yet.

0 commit comments

Comments
 (0)