From 884b969f2ac14f95b00a287eeb98c474cc330732 Mon Sep 17 00:00:00 2001 From: m4b Date: Mon, 1 Aug 2016 23:42:15 -0700 Subject: [PATCH 1/2] Add -mrelax-relocations=no hacks to fix musl build --- mk/cfg/x86_64-unknown-linux-musl.mk | 4 ++-- src/bootstrap/lib.rs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mk/cfg/x86_64-unknown-linux-musl.mk b/mk/cfg/x86_64-unknown-linux-musl.mk index 3a03b2accd5..6f707ac3b3f 100644 --- a/mk/cfg/x86_64-unknown-linux-musl.mk +++ b/mk/cfg/x86_64-unknown-linux-musl.mk @@ -7,8 +7,8 @@ CFG_INSTALL_ONLY_RLIB_x86_64-unknown-linux-musl = 1 CFG_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).so CFG_STATIC_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).a CFG_LIB_GLOB_x86_64-unknown-linux-musl=lib$(1)-*.so -CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-musl := -m64 -CFG_GCCISH_CFLAGS_x86_64-unknown-linux-musl := -g -fPIC -m64 +CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-musl := -m64 -Wa,-mrelax-relocations=no +CFG_GCCISH_CFLAGS_x86_64-unknown-linux-musl := -g -fPIC -m64 -Wa,-mrelax-relocations=no CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-musl := CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-musl := CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-musl := diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 25356b86221..ac444e5fcc2 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -855,6 +855,12 @@ impl Build { base.push("-stdlib=libc++".into()); base.push("-mmacosx-version-min=10.7".into()); } + // This is a hack, because newer binutils broke things + // on some vms/distros (i.e., linking against unknown relocs disabled by the following flag) + // See: https://github.com/rust-lang/rust/issues/34978 + if target == "x86_64-unknown-linux-musl" { + base.push("-Wa,-mrelax-relocations=no".into()); + } return base } From 5383cd7163a4334095d6d956508bd0f8911ac6c7 Mon Sep 17 00:00:00 2001 From: m4b Date: Tue, 2 Aug 2016 09:54:05 -0700 Subject: [PATCH 2/2] Fix style issues --- src/bootstrap/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index ac444e5fcc2..acb7e0fadd9 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -855,8 +855,8 @@ impl Build { base.push("-stdlib=libc++".into()); base.push("-mmacosx-version-min=10.7".into()); } - // This is a hack, because newer binutils broke things - // on some vms/distros (i.e., linking against unknown relocs disabled by the following flag) + // This is a hack, because newer binutils broke things on some vms/distros + // (i.e., linking against unknown relocs disabled by the following flag) // See: https://github.com/rust-lang/rust/issues/34978 if target == "x86_64-unknown-linux-musl" { base.push("-Wa,-mrelax-relocations=no".into());