Skip to content

Commit 8edfb35

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 3a14de5 commit 8edfb35

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
@@ -59,14 +59,7 @@ pub fn opts() -> TargetOptions {
5959
base.pre_link_objects_exe.push("crti.o".to_string());
6060
base.post_link_objects.push("crtn.o".to_string());
6161

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

7265
base

src/librustc_back/target/mips_unknown_linux_musl.rs

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

28+
crt_static_default: false,
2829
// see #36994
2930
exe_allocation_crate: "alloc_system".to_string(),
3031

src/librustc_back/target/mipsel_unknown_linux_musl.rs

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

28+
crt_static_default: false,
2829
// see #36994
2930
exe_allocation_crate: "alloc_system".to_string(),
3031

0 commit comments

Comments
 (0)