Skip to content

Commit 884b969

Browse files
committed
Add -mrelax-relocations=no hacks to fix musl build
1 parent 1ece9ca commit 884b969

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

mk/cfg/x86_64-unknown-linux-musl.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ CFG_INSTALL_ONLY_RLIB_x86_64-unknown-linux-musl = 1
77
CFG_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).so
88
CFG_STATIC_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).a
99
CFG_LIB_GLOB_x86_64-unknown-linux-musl=lib$(1)-*.so
10-
CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-musl := -m64
11-
CFG_GCCISH_CFLAGS_x86_64-unknown-linux-musl := -g -fPIC -m64
10+
CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-musl := -m64 -Wa,-mrelax-relocations=no
11+
CFG_GCCISH_CFLAGS_x86_64-unknown-linux-musl := -g -fPIC -m64 -Wa,-mrelax-relocations=no
1212
CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-musl :=
1313
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-musl :=
1414
CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-musl :=

src/bootstrap/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,12 @@ impl Build {
855855
base.push("-stdlib=libc++".into());
856856
base.push("-mmacosx-version-min=10.7".into());
857857
}
858+
// This is a hack, because newer binutils broke things
859+
// on some vms/distros (i.e., linking against unknown relocs disabled by the following flag)
860+
// See: https://github.com/rust-lang/rust/issues/34978
861+
if target == "x86_64-unknown-linux-musl" {
862+
base.push("-Wa,-mrelax-relocations=no".into());
863+
}
858864
return base
859865
}
860866

0 commit comments

Comments
 (0)