Skip to content

Commit 9cf1897

Browse files
authoredAug 3, 2016
Auto merge of #35178 - m4b:fix-relx-musl, r=alexcrichton
Add -mrelax-relocations=no hacks to fix musl build * this is just a start, dunno if it will work, but I'll just push it out to get feedback (my rust is still building 😢) * I don't know much about rustbuild, so i just added that flag in there. it's a total hack, don't judge me * I suspect the places in the musl .mk files are sufficient (but we may also need it present when building std), I'm not sure, needs more testing.
2 parents ea07d52 + 5383cd7 commit 9cf1897

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 on some vms/distros
859+
// (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)
Please sign in to comment.