Skip to content

Commit 2a93336

Browse files
committed
Support dynamic linking for musl-based targets
To maintain existing behavior, it is disabled by default on all architectures except MIPS.
1 parent d39c8e7 commit 2a93336

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

src/librustc_back/target/linux_musl_base.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,7 @@ pub fn opts() -> TargetOptions {
6060
base.pre_link_objects_exe.push("crti.o".to_string());
6161
base.post_link_objects.push("crtn.o".to_string());
6262

63-
// MUSL support doesn't currently include dynamic linking, so there's no
64-
// need for dylibs or rpath business. Additionally `-pie` is incompatible
65-
// with `-static`, so we can't pass `-pie`.
66-
base.dynamic_linking = false;
67-
base.has_rpath = false;
68-
base.position_independent_executables = false;
69-
70-
// These targets statically link libc by default
63+
// Except for on MIPS, these targets statically link libc by default.
7164
base.crt_static_default = true;
7265

7366
base

src/librustc_back/target/mips_unknown_linux_musl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub fn target() -> TargetResult {
2727
features: "+mips32r2,+soft-float".to_string(),
2828
max_atomic_width: Some(32),
2929

30+
crt_static_default: false,
3031
// see #36994
3132
exe_allocation_crate: "alloc_system".to_string(),
3233

src/librustc_back/target/mipsel_unknown_linux_musl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub fn target() -> TargetResult {
2727
features: "+mips32,+soft-float".to_string(),
2828
max_atomic_width: Some(32),
2929

30+
crt_static_default: false,
3031
// see #36994
3132
exe_allocation_crate: "alloc_system".to_string(),
3233

0 commit comments

Comments
 (0)