mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Auto merge of #24777 - alexcrichton:musl, r=brson
These commits build on [some great work on reddit](http://www.reddit.com/r/rust/comments/33boew/weekend_experiment_link_rust_programs_against/) for adding MUSL support to the compiler. This goal of this PR is to enable a `--target x86_64-unknown-linux-musl` argument to the compiler to work A-OK. The outcome here is that there are 0 compile-time dependencies for a MUSL-targeting build *except for a linker*. Currently this also assumes that MUSL is being used for statically linked binaries so there is no support for dynamically linked binaries with MUSL. MUSL support largely just entailed munging around with the linker and where libs are located, and the major highlights are: * The entirety of `libc.a` is included in `liblibc.rlib` (statically included as an archive). * The entirety of `libunwind.a` is included in `libstd.rlib` (like with liblibc). * The target specification for MUSL passes a number of ... flavorful options! Each option is documented in the relevant commit. * The entire test suite currently passes with MUSL as a target, except for: * Dynamic linking tests are all ignored as it's not supported with MUSL * Stack overflow detection is not working MUSL yet (I'm not sure why) * There is a language change included in this PR to add a `target_env` `#[cfg]` directive. This is used to conditionally build code for only MUSL (or for linux distros not MUSL). I highly suspect that this will also be used by Windows to target MSVC instead of a MinGW-based toolchain. To build a compiler targeting MUSL you need to follow these steps: 1. Clone the current MUSL repo from `git://git.musl-libc.org/musl`. Build this as usual and install it. 2. Clone and build LLVM's [libcxxabi](http://libcxxabi.llvm.org/) library. Only the `libunwind.a` artifact is needed. I have tried using upstream libunwind's source repo but I have not gotten unwinding to work with it unfortunately. Move `libunwind.a` adjacent to MUSL's `libc.a` 3. Configure a Rust checkout with `--target=x86_64-unknown-linux-musl --musl-root=$MUSL_ROOT` where `MUSL_ROOT` is where you installed MUSL in step 1. I hope to improve building a copy of libunwind as it's still a little sketchy and difficult to do today, but other than that everything should "just work"! This PR is not intended to include 100% comprehensive support for MUSL, as future modifications will probably be necessary.
This commit is contained in:
commit
cadc67e8fd
8
configure
vendored
8
configure
vendored
@ -583,6 +583,7 @@ valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
|
||||
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
|
||||
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
|
||||
valopt release-channel "dev" "the name of the release channel to build"
|
||||
valopt musl-root "/usr/local" "MUSL root installation directory"
|
||||
|
||||
# Many of these are saved below during the "writing configuration" step
|
||||
# (others are conditionally saved).
|
||||
@ -1058,6 +1059,13 @@ do
|
||||
fi
|
||||
;;
|
||||
|
||||
|
||||
*-musl)
|
||||
if [ ! -f $CFG_MUSL_ROOT/lib/libc.a ]
|
||||
then
|
||||
err "musl libc $CFG_MUSL_ROOT/lib/libc.a not found"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
@ -20,16 +20,12 @@ CFG_GCCISH_CFLAGS_aarch64-apple-ios := -Wall -Werror -fPIC $(CFG_IOS_SDK_FLAGS_a
|
||||
CFG_GCCISH_CXXFLAGS_aarch64-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) -I$(CFG_IOS_SDK_aarch64-apple-ios)/usr/include/c++/4.2.1
|
||||
CFG_GCCISH_LINK_FLAGS_aarch64-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_aarch64-apple-ios) -Wl,-no_compact_unwind
|
||||
CFG_GCCISH_DEF_FLAG_aarch64-apple-ios := -Wl,-exported_symbols_list,
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_aarch64-apple-ios :=
|
||||
CFG_GCCISH_POST_LIB_FLAGS_aarch64-apple-ios :=
|
||||
CFG_DEF_SUFFIX_aarch64-apple-ios := .darwin.def
|
||||
CFG_LLC_FLAGS_aarch64-apple-ios := -mattr=+neon,+cyclone,+fp-armv8
|
||||
CFG_INSTALL_NAME_aarch64-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||
CFG_LIBUV_LINK_FLAGS_aarch64-apple-ios =
|
||||
CFG_EXE_SUFFIX_aarch64-apple-ios :=
|
||||
CFG_WINDOWSY_aarch64-apple-ios :=
|
||||
CFG_UNIXY_aarch64-apple-ios := 1
|
||||
CFG_PATH_MUNGE_aarch64-apple-ios := true
|
||||
CFG_LDPATH_aarch64-apple-ios :=
|
||||
CFG_RUN_aarch64-apple-ios = $(2)
|
||||
CFG_RUN_TARG_aarch64-apple-ios = $(call CFG_RUN_aarch64-apple-ios,,$(2))
|
||||
|
@ -13,15 +13,11 @@ CFG_GCCISH_CFLAGS_aarch64-linux-android := -Wall -g -fPIC -D__aarch64__ -DANDROI
|
||||
CFG_GCCISH_CXXFLAGS_aarch64-linux-android := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_aarch64-linux-android := -shared -fPIC -ldl -g -lm -lsupc++
|
||||
CFG_GCCISH_DEF_FLAG_aarch64-linux-android := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_aarch64-linux-android := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_aarch64-linux-android := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_aarch64-linux-android := .android.def
|
||||
CFG_LLC_FLAGS_aarch64-linux-android :=
|
||||
CFG_INSTALL_NAME_aarch64-linux-android =
|
||||
CFG_EXE_SUFFIX_aarch64-linux-android :=
|
||||
CFG_WINDOWSY_aarch64-linux-android :=
|
||||
CFG_UNIXY_aarch64-linux-android := 1
|
||||
CFG_PATH_MUNGE_aarch64-linux-android := true
|
||||
CFG_LDPATH_aarch64-linux-android :=
|
||||
CFG_RUN_aarch64-linux-android=
|
||||
CFG_RUN_TARG_aarch64-linux-android=
|
||||
|
@ -13,15 +13,11 @@ CFG_GCCISH_CFLAGS_aarch64-unknown-linux-gnu := -Wall -g -fPIC -D__aarch64__ $(CF
|
||||
CFG_GCCISH_CXXFLAGS_aarch64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_aarch64-unknown-linux-gnu := -shared -fPIC -g
|
||||
CFG_GCCISH_DEF_FLAG_aarch64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_aarch64-unknown-linux-gnu := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_aarch64-unknown-linux-gnu := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_aarch64-unknown-linux-gnu := .linux.def
|
||||
CFG_LLC_FLAGS_aarch64-unknown-linux-gnu :=
|
||||
CFG_INSTALL_NAME_aarch64-unknown-linux-gnu =
|
||||
CFG_EXE_SUFFIX_aarch64-unknown-linux-gnu :=
|
||||
CFG_WINDOWSY_aarch64-unknown-linux-gnu :=
|
||||
CFG_UNIXY_aarch64-unknown-linux-gnu := 1
|
||||
CFG_PATH_MUNGE_aarch64-unknown-linux-gnu := true
|
||||
CFG_LDPATH_aarch64-unknown-linux-gnu :=
|
||||
CFG_RUN_aarch64-unknown-linux-gnu=$(2)
|
||||
CFG_RUN_TARG_aarch64-unknown-linux-gnu=$(call CFG_RUN_aarch64-unknown-linux-gnu,,$(2))
|
||||
|
@ -12,15 +12,11 @@ CFG_GCCISH_CFLAGS_arm-linux-androideabi := -Wall -g -fPIC -D__arm__ -DANDROID -D
|
||||
CFG_GCCISH_CXXFLAGS_arm-linux-androideabi := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_arm-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++
|
||||
CFG_GCCISH_DEF_FLAG_arm-linux-androideabi := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_arm-linux-androideabi := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_arm-linux-androideabi := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_arm-linux-androideabi := .android.def
|
||||
CFG_LLC_FLAGS_arm-linux-androideabi :=
|
||||
CFG_INSTALL_NAME_arm-linux-androideabi =
|
||||
CFG_EXE_SUFFIX_arm-linux-androideabi :=
|
||||
CFG_WINDOWSY_arm-linux-androideabi :=
|
||||
CFG_UNIXY_arm-linux-androideabi := 1
|
||||
CFG_PATH_MUNGE_arm-linux-androideabi := true
|
||||
CFG_LDPATH_arm-linux-androideabi :=
|
||||
CFG_RUN_arm-linux-androideabi=
|
||||
CFG_RUN_TARG_arm-linux-androideabi=
|
||||
|
@ -13,15 +13,11 @@ CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfpu=vf
|
||||
CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabi := -shared -fPIC -g
|
||||
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_arm-unknown-linux-gnueabi := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_arm-unknown-linux-gnueabi := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_arm-unknown-linux-gnueabi := .linux.def
|
||||
CFG_LLC_FLAGS_arm-unknown-linux-gnueabi :=
|
||||
CFG_INSTALL_NAME_arm-unknown-linux-gnueabi =
|
||||
CFG_EXE_SUFFIX_arm-unknown-linux-gnueabi :=
|
||||
CFG_WINDOWSY_arm-unknown-linux-gnueabi :=
|
||||
CFG_UNIXY_arm-unknown-linux-gnueabi := 1
|
||||
CFG_PATH_MUNGE_arm-unknown-linux-gnueabi := true
|
||||
CFG_LDPATH_arm-unknown-linux-gnueabi :=
|
||||
CFG_RUN_arm-unknown-linux-gnueabi=$(2)
|
||||
CFG_RUN_TARG_arm-unknown-linux-gnueabi=$(call CFG_RUN_arm-unknown-linux-gnueabi,,$(2))
|
||||
|
@ -13,15 +13,11 @@ CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLA
|
||||
CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabihf := -shared -fPIC -g
|
||||
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_arm-unknown-linux-gnueabihf := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_arm-unknown-linux-gnueabihf := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_arm-unknown-linux-gnueabihf := .linux.def
|
||||
CFG_LLC_FLAGS_arm-unknown-linux-gnueabihf :=
|
||||
CFG_INSTALL_NAME_ar,-unknown-linux-gnueabihf =
|
||||
CFG_EXE_SUFFIX_arm-unknown-linux-gnueabihf :=
|
||||
CFG_WINDOWSY_arm-unknown-linux-gnueabihf :=
|
||||
CFG_UNIXY_arm-unknown-linux-gnueabihf := 1
|
||||
CFG_PATH_MUNGE_arm-unknown-linux-gnueabihf := true
|
||||
CFG_LDPATH_arm-unknown-linux-gnueabihf :=
|
||||
CFG_RUN_arm-unknown-linux-gnueabihf=$(2)
|
||||
CFG_RUN_TARG_arm-unknown-linux-gnueabihf=$(call CFG_RUN_arm-unknown-linux-gnueabihf,,$(2))
|
||||
|
@ -19,15 +19,11 @@ CFG_GCCISH_CFLAGS_armv7-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_SDK_FLAGS_
|
||||
CFG_GCCISH_CXXFLAGS_armv7-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -I$(CFG_IOS_SDK_armv7-apple-ios)/usr/include/c++/4.2.1
|
||||
CFG_GCCISH_LINK_FLAGS_armv7-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7-apple-ios) -Wl,-no_compact_unwind
|
||||
CFG_GCCISH_DEF_FLAG_armv7-apple-ios := -Wl,-exported_symbols_list,
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_armv7-apple-ios :=
|
||||
CFG_GCCISH_POST_LIB_FLAGS_armv7-apple-ios :=
|
||||
CFG_DEF_SUFFIX_armv7-apple-ios := .darwin.def
|
||||
CFG_LLC_FLAGS_armv7-apple-ios := -mattr=+vfp3,+v7,+neon -march=arm
|
||||
CFG_INSTALL_NAME_armv7-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||
CFG_EXE_SUFFIX_armv7-apple-ios :=
|
||||
CFG_WINDOWSY_armv7-apple-ios :=
|
||||
CFG_UNIXY_armv7-apple-ios := 1
|
||||
CFG_PATH_MUNGE_armv7-apple-ios := true
|
||||
CFG_LDPATH_armv7-apple-ios :=
|
||||
CFG_RUN_armv7-apple-ios = $(2)
|
||||
CFG_RUN_TARG_armv7-apple-ios = $(call CFG_RUN_armv7-apple-ios,,$(2))
|
||||
|
@ -19,15 +19,11 @@ CFG_GCCISH_CFLAGS_armv7s-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_SDK_FLAGS
|
||||
CFG_GCCISH_CXXFLAGS_armv7s-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -I$(CFG_IOS_SDK_armv7s-apple-ios)/usr/include/c++/4.2.1
|
||||
CFG_GCCISH_LINK_FLAGS_armv7s-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7s-apple-ios) -Wl,-no_compact_unwind
|
||||
CFG_GCCISH_DEF_FLAG_armv7s-apple-ios := -Wl,-exported_symbols_list,
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_armv7s-apple-ios :=
|
||||
CFG_GCCISH_POST_LIB_FLAGS_armv7s-apple-ios :=
|
||||
CFG_DEF_SUFFIX_armv7s-apple-ios := .darwin.def
|
||||
CFG_LLC_FLAGS_armv7s-apple-ios := -mattr=+vfp4,+v7,+neon
|
||||
CFG_INSTALL_NAME_armv7s-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||
CFG_EXE_SUFFIX_armv7s-apple-ios :=
|
||||
CFG_WINDOWSY_armv7s-apple-ios :=
|
||||
CFG_UNIXY_armv7s-apple-ios := 1
|
||||
CFG_PATH_MUNGE_armv7s-apple-ios := true
|
||||
CFG_LDPATH_armv7s-apple-ios :=
|
||||
CFG_RUN_armv7s-apple-ios = $(2)
|
||||
CFG_RUN_TARG_armv7s-apple-ios = $(call CFG_RUN_armv7s-apple-ios,,$(2))
|
||||
|
@ -18,15 +18,11 @@ CFG_GCCISH_CFLAGS_i386-apple-ios := -Wall -Werror -g -fPIC -m32 $(CFG_IOSSIM_FLA
|
||||
CFG_GCCISH_CXXFLAGS_i386-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_i386-apple-ios) -I$(CFG_IOSSIM_SDK_i386-apple-ios)/usr/include/c++/4.2.1
|
||||
CFG_GCCISH_LINK_FLAGS_i386-apple-ios := -lpthread -m32 -Wl,-no_compact_unwind -m32 -Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios)
|
||||
CFG_GCCISH_DEF_FLAG_i386-apple-ios := -Wl,-exported_symbols_list,
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_i386-apple-ios :=
|
||||
CFG_GCCISH_POST_LIB_FLAGS_i386-apple-ios :=
|
||||
CFG_DEF_SUFFIX_i386-apple-ios := .darwin.def
|
||||
CFG_LLC_FLAGS_i386-apple-ios =
|
||||
CFG_INSTALL_NAME_i386-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||
CFG_EXE_SUFFIX_i386-apple-ios :=
|
||||
CFG_WINDOWSY_i386-apple-ios :=
|
||||
CFG_UNIXY_i386-apple-ios := 1
|
||||
CFG_PATH_MUNGE_i386-apple-ios = :true
|
||||
CFG_LDPATH_i386-apple-ios =
|
||||
CFG_RUN_i386-apple-ios = $(2)
|
||||
CFG_RUN_TARG_i386-apple-ios = $(call CFG_RUN_i386-apple-ios,,$(2))
|
||||
|
@ -12,15 +12,11 @@ CFG_GCCISH_CFLAGS_i686-apple-darwin := -Wall -Werror -g -fPIC -m32 -arch i386 $(
|
||||
CFG_GCCISH_CXXFLAGS_i686-apple-darwin := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_i686-apple-darwin := -dynamiclib -pthread -framework CoreServices -m32
|
||||
CFG_GCCISH_DEF_FLAG_i686-apple-darwin := -Wl,-exported_symbols_list,
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_i686-apple-darwin :=
|
||||
CFG_GCCISH_POST_LIB_FLAGS_i686-apple-darwin :=
|
||||
CFG_DEF_SUFFIX_i686-apple-darwin := .darwin.def
|
||||
CFG_LLC_FLAGS_i686-apple-darwin :=
|
||||
CFG_INSTALL_NAME_i686-apple-darwin = -Wl,-install_name,@rpath/$(1)
|
||||
CFG_EXE_SUFFIX_i686-apple-darwin :=
|
||||
CFG_WINDOWSY_i686-apple-darwin :=
|
||||
CFG_UNIXY_i686-apple-darwin := 1
|
||||
CFG_PATH_MUNGE_i686-apple-darwin := true
|
||||
CFG_LDPATH_i686-apple-darwin :=
|
||||
CFG_RUN_i686-apple-darwin=$(2)
|
||||
CFG_RUN_TARG_i686-apple-darwin=$(call CFG_RUN_i686-apple-darwin,,$(2))
|
||||
|
@ -13,15 +13,11 @@ CFG_GCCISH_CFLAGS_i686-pc-windows-gnu := -Wall -Werror -g -m32 -D_WIN32_WINNT=0x
|
||||
CFG_GCCISH_CXXFLAGS_i686-pc-windows-gnu := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_i686-pc-windows-gnu := -shared -g -m32
|
||||
CFG_GCCISH_DEF_FLAG_i686-pc-windows-gnu :=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_i686-pc-windows-gnu :=
|
||||
CFG_GCCISH_POST_LIB_FLAGS_i686-pc-windows-gnu :=
|
||||
CFG_DEF_SUFFIX_i686-pc-windows-gnu := .windows.def
|
||||
CFG_LLC_FLAGS_i686-pc-windows-gnu :=
|
||||
CFG_INSTALL_NAME_i686-pc-windows-gnu =
|
||||
CFG_EXE_SUFFIX_i686-pc-windows-gnu := .exe
|
||||
CFG_WINDOWSY_i686-pc-windows-gnu := 1
|
||||
CFG_UNIXY_i686-pc-windows-gnu :=
|
||||
CFG_PATH_MUNGE_i686-pc-windows-gnu :=
|
||||
CFG_LDPATH_i686-pc-windows-gnu :=
|
||||
CFG_RUN_i686-pc-windows-gnu=$(2)
|
||||
CFG_RUN_TARG_i686-pc-windows-gnu=$(call CFG_RUN_i686-pc-windows-gnu,,$(2))
|
||||
|
@ -12,15 +12,11 @@ CFG_GCCISH_CFLAGS_i686-unknown-linux-gnu := -Wall -Werror -g -fPIC -m32 $(CFLAGS
|
||||
CFG_GCCISH_CXXFLAGS_i686-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32
|
||||
CFG_GCCISH_DEF_FLAG_i686-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_i686-unknown-linux-gnu := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_i686-unknown-linux-gnu := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_i686-unknown-linux-gnu := .linux.def
|
||||
CFG_LLC_FLAGS_i686-unknown-linux-gnu :=
|
||||
CFG_INSTALL_NAME_i686-unknown-linux-gnu =
|
||||
CFG_EXE_SUFFIX_i686-unknown-linux-gnu =
|
||||
CFG_WINDOWSY_i686-unknown-linux-gnu :=
|
||||
CFG_UNIXY_i686-unknown-linux-gnu := 1
|
||||
CFG_PATH_MUNGE_i686-unknown-linux-gnu := true
|
||||
CFG_LDPATH_i686-unknown-linux-gnu :=
|
||||
CFG_RUN_i686-unknown-linux-gnu=$(2)
|
||||
CFG_RUN_TARG_i686-unknown-linux-gnu=$(call CFG_RUN_i686-unknown-linux-gnu,,$(2))
|
||||
|
@ -12,15 +12,11 @@ CFG_GCCISH_CFLAGS_mips-unknown-linux-gnu := -Wall -g -fPIC -mips32r2 -msoft-floa
|
||||
CFG_GCCISH_CXXFLAGS_mips-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_mips-unknown-linux-gnu := -shared -fPIC -g -mips32r2 -msoft-float -mabi=32
|
||||
CFG_GCCISH_DEF_FLAG_mips-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_mips-unknown-linux-gnu := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_mips-unknown-linux-gnu := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_mips-unknown-linux-gnu := .linux.def
|
||||
CFG_LLC_FLAGS_mips-unknown-linux-gnu :=
|
||||
CFG_INSTALL_NAME_mips-unknown-linux-gnu =
|
||||
CFG_EXE_SUFFIX_mips-unknown-linux-gnu :=
|
||||
CFG_WINDOWSY_mips-unknown-linux-gnu :=
|
||||
CFG_UNIXY_mips-unknown-linux-gnu := 1
|
||||
CFG_PATH_MUNGE_mips-unknown-linux-gnu := true
|
||||
CFG_LDPATH_mips-unknown-linux-gnu :=
|
||||
CFG_RUN_mips-unknown-linux-gnu=
|
||||
CFG_RUN_TARG_mips-unknown-linux-gnu=
|
||||
|
@ -12,15 +12,11 @@ CFG_GCCISH_CFLAGS_mipsel-unknown-linux-gnu := -Wall -g -fPIC -mips32 -mabi=32 $(
|
||||
CFG_GCCISH_CXXFLAGS_mipsel-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_mipsel-unknown-linux-gnu := -shared -fPIC -g -mips32
|
||||
CFG_GCCISH_DEF_FLAG_mipsel-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_mipsel-unknown-linux-gnu := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_mipsel-unknown-linux-gnu := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_mipsel-unknown-linux-gnu := .linux.def
|
||||
CFG_LLC_FLAGS_mipsel-unknown-linux-gnu :=
|
||||
CFG_INSTALL_NAME_mipsel-unknown-linux-gnu =
|
||||
CFG_EXE_SUFFIX_mipsel-unknown-linux-gnu :=
|
||||
CFG_WINDOWSY_mipsel-unknown-linux-gnu :=
|
||||
CFG_UNIXY_mipsel-unknown-linux-gnu := 1
|
||||
CFG_PATH_MUNGE_mipsel-unknown-linux-gnu := true
|
||||
CFG_LDPATH_mipsel-unknown-linux-gnu :=
|
||||
CFG_RUN_mipsel-unknown-linux-gnu=
|
||||
CFG_RUN_TARG_mipsel-unknown-linux-gnu=
|
||||
|
@ -13,15 +13,11 @@ CFG_GCCISH_CFLAGS_powerpc-unknown-linux-gnu := -Wall -Werror -g -fPIC -m32 $(CFL
|
||||
CFG_GCCISH_CXXFLAGS_powerpc-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_powerpc-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32
|
||||
CFG_GCCISH_DEF_FLAG_powerpc-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_powerpc-unknown-linux-gnu := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_powerpc-unknown-linux-gnu := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_powerpc-unknown-linux-gnu := .linux.def
|
||||
CFG_LLC_FLAGS_powerpc-unknown-linux-gnu :=
|
||||
CFG_INSTALL_NAME_powerpc-unknown-linux-gnu =
|
||||
CFG_EXE_SUFFIX_powerpc-unknown-linux-gnu =
|
||||
CFG_WINDOWSY_powerpc-unknown-linux-gnu :=
|
||||
CFG_UNIXY_powerpc-unknown-linux-gnu := 1
|
||||
CFG_PATH_MUNGE_powerpc-unknown-linux-gnu := true
|
||||
CFG_LDPATH_powerpc-unknown-linux-gnu :=
|
||||
CFG_RUN_powerpc-unknown-linux-gnu=$(2)
|
||||
CFG_RUN_TARG_powerpc-unknown-linux-gnu=$(call CFG_RUN_powerpc-unknown-linux-gnu,,$(2))
|
||||
|
@ -12,15 +12,11 @@ CFG_GCCISH_CFLAGS_x86_64-apple-darwin := -Wall -Werror -g -fPIC -m64 -arch x86_6
|
||||
CFG_GCCISH_CXXFLAGS_x86_64-apple-darwin := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64-apple-darwin := -dynamiclib -pthread -framework CoreServices -m64
|
||||
CFG_GCCISH_DEF_FLAG_x86_64-apple-darwin := -Wl,-exported_symbols_list,
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-apple-darwin :=
|
||||
CFG_GCCISH_POST_LIB_FLAGS_x86_64-apple-darwin :=
|
||||
CFG_DEF_SUFFIX_x86_64-apple-darwin := .darwin.def
|
||||
CFG_LLC_FLAGS_x86_64-apple-darwin :=
|
||||
CFG_INSTALL_NAME_x86_64-apple-darwin = -Wl,-install_name,@rpath/$(1)
|
||||
CFG_EXE_SUFFIX_x86_64-apple-darwin :=
|
||||
CFG_WINDOWSY_x86_64-apple-darwin :=
|
||||
CFG_UNIXY_x86_64-apple-darwin := 1
|
||||
CFG_PATH_MUNGE_x86_64-apple-darwin := true
|
||||
CFG_LDPATH_x86_64-apple-darwin :=
|
||||
CFG_RUN_x86_64-apple-darwin=$(2)
|
||||
CFG_RUN_TARG_x86_64-apple-darwin=$(call CFG_RUN_x86_64-apple-darwin,,$(2))
|
||||
|
@ -20,16 +20,12 @@ CFG_GCCISH_CFLAGS_x86_64-apple-ios := -Wall -Werror -fPIC $(CFG_IOSSIM_FLAGS_x86
|
||||
CFG_GCCISH_CXXFLAGS_x86_64-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) -I$(CFG_IOSSIM_SDK_x86_64-apple-ios)/usr/include/c++/4.2.1
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64-apple-ios := -lpthread -Wl,-no_compact_unwind -m64 -Wl,-syslibroot $(CFG_IOSSIM_SDK_x86_64-apple-ios)
|
||||
CFG_GCCISH_DEF_FLAG_x86_64-apple-ios := -Wl,-exported_symbols_list,
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-apple-ios :=
|
||||
CFG_GCCISH_POST_LIB_FLAGS_x86_64-apple-ios :=
|
||||
CFG_DEF_SUFFIX_x86_64-apple-ios := .darwin.def
|
||||
CFG_LLC_FLAGS_x86_64-apple-ios :=
|
||||
CFG_INSTALL_NAME_x86_64-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||
CFG_LIBUV_LINK_FLAGS_x86_64-apple-ios :=
|
||||
CFG_EXE_SUFFIX_x86_64-apple-ios :=
|
||||
CFG_WINDOWSY_x86_64-apple-ios :=
|
||||
CFG_UNIXY_x86_64-apple-ios := 1
|
||||
CFG_PATH_MUNGE_x86_64-apple-ios := true
|
||||
CFG_LDPATH_x86_64-apple-ios :=
|
||||
CFG_RUN_x86_64-apple-ios = $(2)
|
||||
CFG_RUN_TARG_x86_64-apple-ios = $(call CFG_RUN_x86_64-apple-ios,,$(2))
|
||||
|
@ -13,15 +13,11 @@ CFG_GCCISH_CFLAGS_x86_64-pc-windows-gnu := -Wall -Werror -g -m64 -D_WIN32_WINNT=
|
||||
CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-gnu := -fno-rtti $(CXXFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-gnu := -shared -g -m64
|
||||
CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-gnu :=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-pc-windows-gnu :=
|
||||
CFG_GCCISH_POST_LIB_FLAGS_x86_64-pc-windows-gnu :=
|
||||
CFG_DEF_SUFFIX_x86_64-pc-windows-gnu := .windows.def
|
||||
CFG_LLC_FLAGS_x86_64-pc-windows-gnu :=
|
||||
CFG_INSTALL_NAME_x86_64-pc-windows-gnu =
|
||||
CFG_EXE_SUFFIX_x86_64-pc-windows-gnu := .exe
|
||||
CFG_WINDOWSY_x86_64-pc-windows-gnu := 1
|
||||
CFG_UNIXY_x86_64-pc-windows-gnu :=
|
||||
CFG_PATH_MUNGE_x86_64-pc-windows-gnu :=
|
||||
CFG_LDPATH_x86_64-pc-windows-gnu :=
|
||||
CFG_RUN_x86_64-pc-windows-gnu=$(2)
|
||||
CFG_RUN_TARG_x86_64-pc-windows-gnu=$(call CFG_RUN_x86_64-pc-windows-gnu,,$(2))
|
||||
|
@ -11,15 +11,11 @@ CFG_JEMALLOC_CFLAGS_x86_64-unknown-bitrig := -m64 -I/usr/include $(CFLAGS)
|
||||
CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig := -Wall -Werror -fPIC -m64 -I/usr/include $(CFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 $(LDFLAGS)
|
||||
CFG_GCCISH_DEF_FLAG_x86_64-unknown-bitrig := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-bitrig := -Wl,-pic -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-bitrig := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_x86_64-unknown-bitrig := .bsd.def
|
||||
CFG_LLC_FLAGS_x86_64-unknown-bitrig :=
|
||||
CFG_INSTALL_NAME_x86_64-unknown-bitrig =
|
||||
CFG_EXE_SUFFIX_x86_64-unknown-bitrig :=
|
||||
CFG_WINDOWSY_x86_64-unknown-bitrig :=
|
||||
CFG_UNIXY_x86_64-unknown-bitrig := 1
|
||||
CFG_PATH_MUNGE_x86_64-unknown-bitrig :=
|
||||
CFG_LDPATH_x86_64-unknown-bitrig :=
|
||||
CFG_RUN_x86_64-unknown-bitrig=$(2)
|
||||
CFG_RUN_TARG_x86_64-unknown-bitrig=$(call CFG_RUN_x86_64-unknown-bitrig,,$(2))
|
||||
|
@ -11,15 +11,11 @@ CFG_JEMALLOC_CFLAGS_x86_64-unknown-dragonfly := -m64 -I/usr/include -I/usr/local
|
||||
CFG_GCCISH_CFLAGS_x86_64-unknown-dragonfly := -Wall -Werror -g -fPIC -m64 -I/usr/include -I/usr/local/include $(CFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-dragonfly := -shared -fPIC -g -pthread -lrt -m64
|
||||
CFG_GCCISH_DEF_FLAG_x86_64-unknown-dragonfly := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-dragonfly := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-dragonfly := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_x86_64-unknown-dragonfly := .bsd.def
|
||||
CFG_LLC_FLAGS_x86_64-unknown-dragonfly :=
|
||||
CFG_INSTALL_NAME_x86_64-unknown-dragonfly =
|
||||
CFG_EXE_SUFFIX_x86_64-unknown-dragonfly :=
|
||||
CFG_WINDOWSY_x86_64-unknown-dragonfly :=
|
||||
CFG_UNIXY_x86_64-unknown-dragonfly := 1
|
||||
CFG_PATH_MUNGE_x86_64-unknown-dragonfly :=
|
||||
CFG_LDPATH_x86_64-unknown-dragonfly :=
|
||||
CFG_RUN_x86_64-unknown-dragonfly=$(2)
|
||||
CFG_RUN_TARG_x86_64-unknown-dragonfly=$(call CFG_RUN_x86_64-unknown-dragonfly,,$(2))
|
||||
|
@ -11,15 +11,11 @@ CFG_JEMALLOC_CFLAGS_x86_64-unknown-freebsd := -I/usr/local/include $(CFLAGS)
|
||||
CFG_GCCISH_CFLAGS_x86_64-unknown-freebsd := -Wall -Werror -g -fPIC -I/usr/local/include $(CFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-freebsd := -shared -fPIC -g -pthread -lrt
|
||||
CFG_GCCISH_DEF_FLAG_x86_64-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-freebsd := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-freebsd := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_x86_64-unknown-freebsd := .bsd.def
|
||||
CFG_LLC_FLAGS_x86_64-unknown-freebsd :=
|
||||
CFG_INSTALL_NAME_x86_64-unknown-freebsd =
|
||||
CFG_EXE_SUFFIX_x86_64-unknown-freebsd :=
|
||||
CFG_WINDOWSY_x86_64-unknown-freebsd :=
|
||||
CFG_UNIXY_x86_64-unknown-freebsd := 1
|
||||
CFG_PATH_MUNGE_x86_64-unknown-freebsd :=
|
||||
CFG_LDPATH_x86_64-unknown-freebsd :=
|
||||
CFG_RUN_x86_64-unknown-freebsd=$(2)
|
||||
CFG_RUN_TARG_x86_64-unknown-freebsd=$(call CFG_RUN_x86_64-unknown-freebsd,,$(2))
|
||||
|
@ -12,15 +12,11 @@ CFG_GCCISH_CFLAGS_x86_64-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64
|
||||
CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-gnu := -fno-rtti
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64
|
||||
CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-linux-gnu := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-linux-gnu := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_x86_64-unknown-linux-gnu := .linux.def
|
||||
CFG_LLC_FLAGS_x86_64-unknown-linux-gnu :=
|
||||
CFG_INSTALL_NAME_x86_64-unknown-linux-gnu =
|
||||
CFG_EXE_SUFFIX_x86_64-unknown-linux-gnu =
|
||||
CFG_WINDOWSY_x86_64-unknown-linux-gnu :=
|
||||
CFG_UNIXY_x86_64-unknown-linux-gnu := 1
|
||||
CFG_PATH_MUNGE_x86_64-unknown-linux-gnu := true
|
||||
CFG_LDPATH_x86_64-unknown-linux-gnu :=
|
||||
CFG_RUN_x86_64-unknown-linux-gnu=$(2)
|
||||
CFG_RUN_TARG_x86_64-unknown-linux-gnu=$(call CFG_RUN_x86_64-unknown-linux-gnu,,$(2))
|
||||
|
27
mk/cfg/x86_64-unknown-linux-musl.mk
Normal file
27
mk/cfg/x86_64-unknown-linux-musl.mk
Normal file
@ -0,0 +1,27 @@
|
||||
# x86_64-unknown-linux-musl configuration
|
||||
CC_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc
|
||||
CXX_x86_64-unknown-linux-musl=notaprogram
|
||||
CPP_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -E
|
||||
AR_x86_64-unknown-linux-musl=$(AR)
|
||||
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 := -Wall -Werror -g -fPIC -m64
|
||||
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 :=
|
||||
CFG_LLC_FLAGS_x86_64-unknown-linux-musl :=
|
||||
CFG_INSTALL_NAME_x86_64-unknown-linux-musl =
|
||||
CFG_EXE_SUFFIX_x86_64-unknown-linux-musl =
|
||||
CFG_WINDOWSY_x86_64-unknown-linux-musl :=
|
||||
CFG_UNIXY_x86_64-unknown-linux-musl := 1
|
||||
CFG_LDPATH_x86_64-unknown-linux-musl :=
|
||||
CFG_RUN_x86_64-unknown-linux-musl=$(2)
|
||||
CFG_RUN_TARG_x86_64-unknown-linux-musl=$(call CFG_RUN_x86_64-unknown-linux-musl,,$(2))
|
||||
CFG_GNU_TRIPLE_x86_64-unknown-linux-musl := x86_64-unknown-linux-musl
|
||||
|
||||
NATIVE_DEPS_libc_T_x86_64-unknown-linux-musl += libc.a
|
||||
NATIVE_DEPS_std_T_x86_64-unknown-linux-musl += libunwind.a \
|
||||
crt1.o crti.o crtn.o
|
||||
INSTALLED_OBJECTS_x86_64-unknown-linux-musl += crt1.o crti.o crtn.o
|
@ -11,15 +11,11 @@ CFG_JEMALLOC_CFLAGS_x86_64-unknown-openbsd := -m64 -I/usr/include $(CFLAGS)
|
||||
CFG_GCCISH_CFLAGS_x86_64-unknown-openbsd := -Wall -Werror -g -fPIC -m64 -I/usr/include $(CFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-openbsd := -shared -fPIC -g -pthread -m64
|
||||
CFG_GCCISH_DEF_FLAG_x86_64-unknown-openbsd := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-openbsd := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-openbsd := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_x86_64-unknown-openbsd := .bsd.def
|
||||
CFG_LLC_FLAGS_x86_64-unknown-openbsd :=
|
||||
CFG_INSTALL_NAME_x86_64-unknown-openbsd =
|
||||
CFG_EXE_SUFFIX_x86_64-unknown-openbsd :=
|
||||
CFG_WINDOWSY_x86_64-unknown-openbsd :=
|
||||
CFG_UNIXY_x86_64-unknown-openbsd := 1
|
||||
CFG_PATH_MUNGE_x86_64-unknown-openbsd :=
|
||||
CFG_LDPATH_x86_64-unknown-openbsd :=
|
||||
CFG_RUN_x86_64-unknown-openbsd=$(2)
|
||||
CFG_RUN_TARG_x86_64-unknown-openbsd=$(call CFG_RUN_x86_64-unknown-openbsd,,$(2))
|
||||
|
@ -123,6 +123,9 @@ ONLY_RLIB_rustc_bitflags := 1
|
||||
# Documented-by-default crates
|
||||
DOC_CRATES := std alloc collections core libc rustc_unicode
|
||||
|
||||
# Installed objects/libraries by default
|
||||
INSTALLED_OBJECTS := libmorestack.a libcompiler-rt.a
|
||||
|
||||
################################################################################
|
||||
# You should not need to edit below this line
|
||||
################################################################################
|
||||
|
@ -399,8 +399,10 @@ endif
|
||||
# Prerequisites for using the stageN compiler to build target artifacts
|
||||
TSREQ$(1)_T_$(2)_H_$(3) = \
|
||||
$$(HSREQ$(1)_H_$(3)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a
|
||||
$$(foreach obj,$$(INSTALLED_OBJECTS),\
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj)) \
|
||||
$$(foreach obj,$$(INSTALLED_OBJECTS_$(2)),\
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj))
|
||||
|
||||
# Prerequisites for a working stageN compiler and libraries, for a specific
|
||||
# target
|
||||
|
@ -140,8 +140,8 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
|
||||
$$(if $$(findstring $(2),$$(CFG_HOST)), \
|
||||
$$(foreach crate,$$(HOST_CRATES), \
|
||||
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))),) \
|
||||
$$(call PREPARE_LIB,libmorestack.a) \
|
||||
$$(call PREPARE_LIB,libcompiler-rt.a),),),)
|
||||
$$(foreach object,$$(INSTALLED_OBJECTS) $$(INSTALLED_OBJECTS_$(2)),\
|
||||
$$(call PREPARE_LIB,$$(object))),),),)
|
||||
endef
|
||||
|
||||
define INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS
|
||||
|
23
mk/rt.mk
23
mk/rt.mk
@ -74,7 +74,8 @@ $$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.ll $$(MKFILE_DEPS) \
|
||||
@mkdir -p $$(@D)
|
||||
@$$(call E, compile: $$@)
|
||||
$$(Q)$$(LLC_$$(CFG_BUILD)) $$(CFG_LLC_FLAGS_$(1)) \
|
||||
-filetype=obj -mtriple=$$(CFG_LLVM_TARGET_$(1)) -relocation-model=pic -o $$@ $$<
|
||||
-filetype=obj -mtriple=$$(CFG_LLVM_TARGET_$(1)) \
|
||||
-relocation-model=pic -o $$@ $$<
|
||||
|
||||
$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS)
|
||||
@mkdir -p $$(@D)
|
||||
@ -110,6 +111,11 @@ $$(RT_OUTPUT_DIR_$(1))/$$(NATIVE_$(2)_$(1)): $$(OBJS_$(2)_$(1))
|
||||
@$$(call E, link: $$@)
|
||||
$$(Q)$$(AR_$(1)) rcs $$@ $$^
|
||||
|
||||
ifeq ($$(findstring windows,$(1)),windows)
|
||||
$$(RT_OUTPUT_DIR_$(1))/lib$(2).a: $$(RT_OUTPUT_DIR_$(1))/$$(NATIVE_$(2)_$(1))
|
||||
$$(Q)cp $$^ $$@
|
||||
endif
|
||||
|
||||
endef
|
||||
|
||||
$(foreach target,$(CFG_TARGET), \
|
||||
@ -221,7 +227,7 @@ COMPRT_DEPS := $(wildcard \
|
||||
$(S)src/compiler-rt/*/*/*/*)
|
||||
endif
|
||||
|
||||
COMPRT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
|
||||
COMPRT_NAME_$(1) := libcompiler-rt.a
|
||||
COMPRT_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(COMPRT_NAME_$(1))
|
||||
COMPRT_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/compiler-rt
|
||||
|
||||
@ -312,6 +318,19 @@ endif # endif for windowsy
|
||||
endif # endif for ios
|
||||
endif # endif for darwin
|
||||
|
||||
################################################################################
|
||||
# libc/libunwind for musl
|
||||
#
|
||||
# When we're building a musl-like target we're going to link libc/libunwind
|
||||
# statically into the standard library and liblibc, so we need to make sure
|
||||
# they're in a location that we can find
|
||||
################################################################################
|
||||
|
||||
ifeq ($$(findstring musl,$(1)),musl)
|
||||
$$(RT_OUTPUT_DIR_$(1))/%: $$(CFG_MUSL_ROOT)/lib/%
|
||||
cp $$^ $$@
|
||||
endif
|
||||
|
||||
endef
|
||||
|
||||
# Instantiate template for all stages/targets
|
||||
|
@ -25,8 +25,6 @@ endif
|
||||
RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, \
|
||||
ExecutionEngineWrapper.cpp RustWrapper.cpp PassWrapper.cpp)
|
||||
|
||||
RUSTLLVM_DEF_$(1) := $(1)/rustllvm/rustllvm$(CFG_DEF_SUFFIX_$(1))
|
||||
|
||||
RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
|
||||
-iquote $$(LLVM_INCDIR_$(1)) \
|
||||
-iquote $$(S)src/rustllvm/include
|
||||
|
13
mk/target.mk
13
mk/target.mk
@ -35,7 +35,9 @@ CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4) := \
|
||||
$$(foreach dep,$$(RUST_DEPS_$(4)), \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
|
||||
$$(foreach dep,$$(NATIVE_DEPS_$(4)), \
|
||||
$$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),$$(dep)))
|
||||
$$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),$$(dep))) \
|
||||
$$(foreach dep,$$(NATIVE_DEPS_$(4)_T_$(2)), \
|
||||
$$(RT_OUTPUT_DIR_$(2))/$$(dep))
|
||||
endef
|
||||
|
||||
$(foreach host,$(CFG_HOST), \
|
||||
@ -143,14 +145,7 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/:
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/:
|
||||
mkdir -p $$@
|
||||
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a: \
|
||||
$$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),compiler-rt) \
|
||||
| $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
|
||||
@$$(call E, cp: $$@)
|
||||
$$(Q)cp $$< $$@
|
||||
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
|
||||
$$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),morestack) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/%: $$(RT_OUTPUT_DIR_$(2))/% \
|
||||
| $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
|
||||
@$$(call E, cp: $$@)
|
||||
$$(Q)cp $$< $$@
|
||||
|
@ -170,6 +170,9 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
|
||||
format!("ignore-{}",
|
||||
config.stage_id.split('-').next().unwrap())
|
||||
}
|
||||
fn ignore_env(config: &Config) -> String {
|
||||
format!("ignore-{}", util::get_env(&config.target).unwrap_or("<unknown>"))
|
||||
}
|
||||
fn ignore_gdb(config: &Config, line: &str) -> bool {
|
||||
if config.mode != common::DebugInfoGdb {
|
||||
return false;
|
||||
@ -231,6 +234,7 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
|
||||
!parse_name_directive(ln, &ignore_target(config)) &&
|
||||
!parse_name_directive(ln, &ignore_architecture(config)) &&
|
||||
!parse_name_directive(ln, &ignore_stage(config)) &&
|
||||
!parse_name_directive(ln, &ignore_env(config)) &&
|
||||
!(config.mode == common::Pretty && parse_name_directive(ln, "ignore-pretty")) &&
|
||||
!(config.target != config.host && parse_name_directive(ln, "ignore-cross-compile")) &&
|
||||
!ignore_gdb(config, ln) &&
|
||||
|
@ -1232,8 +1232,21 @@ fn compose_and_run_compiler(config: &Config, props: &TestProps,
|
||||
let aux_props = header::load_props(&abs_ab);
|
||||
let mut crate_type = if aux_props.no_prefer_dynamic {
|
||||
Vec::new()
|
||||
} else {
|
||||
// We primarily compile all auxiliary libraries as dynamic libraries
|
||||
// to avoid code size bloat and large binaries as much as possible
|
||||
// for the test suite (otherwise including libstd statically in all
|
||||
// executables takes up quite a bit of space).
|
||||
//
|
||||
// For targets like MUSL, however, there is no support for dynamic
|
||||
// libraries so we just go back to building a normal library. Note,
|
||||
// however, that if the library is built with `force_host` then it's
|
||||
// ok to be a dylib as the host should always support dylibs.
|
||||
if config.target.contains("musl") && !aux_props.force_host {
|
||||
vec!("--crate-type=lib".to_string())
|
||||
} else {
|
||||
vec!("--crate-type=dylib".to_string())
|
||||
}
|
||||
};
|
||||
crate_type.extend(extra_link_args.clone().into_iter());
|
||||
let aux_args =
|
||||
|
@ -60,6 +60,10 @@ pub fn get_arch(triple: &str) -> &'static str {
|
||||
panic!("Cannot determine Architecture from triple");
|
||||
}
|
||||
|
||||
pub fn get_env(triple: &str) -> Option<&str> {
|
||||
triple.split('-').nth(3)
|
||||
}
|
||||
|
||||
pub fn make_new_path(path: &str) -> String {
|
||||
assert!(cfg!(windows));
|
||||
// Windows just uses PATH as the library search path, so we have to
|
||||
|
@ -211,7 +211,9 @@ mod imp {
|
||||
}
|
||||
|
||||
// -lpthread needs to occur after -ljemalloc, the earlier argument isn't enough
|
||||
#[cfg(all(not(windows), not(target_os = "android")))]
|
||||
#[cfg(all(not(windows),
|
||||
not(target_os = "android"),
|
||||
not(target_env = "musl")))]
|
||||
#[link(name = "pthread")]
|
||||
extern {}
|
||||
|
||||
|
@ -140,11 +140,15 @@ pub use funcs::bsd43::*;
|
||||
|
||||
// On NaCl, these libraries are static. Thus it would be a Bad Idea to link them
|
||||
// in when creating a test crate.
|
||||
#[cfg(not(any(windows, all(target_os = "nacl", test))))]
|
||||
#[cfg(not(any(windows, target_env = "musl", all(target_os = "nacl", test))))]
|
||||
#[link(name = "c")]
|
||||
#[link(name = "m")]
|
||||
extern {}
|
||||
|
||||
#[cfg(all(target_env = "musl", not(test)))]
|
||||
#[link(name = "c", kind = "static")]
|
||||
extern {}
|
||||
|
||||
// libnacl provides functions that require a trip through the IRT to work.
|
||||
// ie: _exit, mmap, nanosleep, etc. Anything that would otherwise require a trip
|
||||
// to the kernel.
|
||||
|
@ -621,6 +621,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
|
||||
let arch = &sess.target.target.arch;
|
||||
let wordsz = &sess.target.target.target_pointer_width;
|
||||
let os = &sess.target.target.target_os;
|
||||
let env = &sess.target.target.target_env;
|
||||
|
||||
let fam = match sess.target.target.options.is_like_windows {
|
||||
true => InternedString::new("windows"),
|
||||
@ -634,8 +635,8 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
|
||||
mk(InternedString::new("target_family"), fam),
|
||||
mk(InternedString::new("target_arch"), intern(arch)),
|
||||
mk(InternedString::new("target_endian"), intern(end)),
|
||||
mk(InternedString::new("target_pointer_width"),
|
||||
intern(wordsz))
|
||||
mk(InternedString::new("target_pointer_width"), intern(wordsz)),
|
||||
mk(InternedString::new("target_env"), intern(env)),
|
||||
];
|
||||
if sess.opts.debug_assertions {
|
||||
ret.push(attr::mk_word_item(InternedString::new("debug_assertions")));
|
||||
|
@ -22,6 +22,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+cyclone".to_string(),
|
||||
eliminate_frame_pointer: false,
|
||||
|
@ -24,6 +24,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "android".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ pub fn target() -> Target {
|
||||
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
target_env: "gnu".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
options: base,
|
||||
|
@ -31,6 +31,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "android".to_string(),
|
||||
target_env: "gnu".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_env: "gnueabi".to_string(),
|
||||
|
||||
options: TargetOptions {
|
||||
features: "+v6".to_string(),
|
||||
|
@ -23,6 +23,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_env: "gnueabihf".to_string(),
|
||||
|
||||
options: TargetOptions {
|
||||
features: "+v6,+vfp2".to_string(),
|
||||
|
@ -19,6 +19,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: TargetOptions {
|
||||
features: "+v7,+vfp3,+neon".to_string(),
|
||||
.. opts(Arch::Armv7)
|
||||
|
@ -19,6 +19,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "arm".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: TargetOptions {
|
||||
features: "+v7,+vfp4,+neon".to_string(),
|
||||
.. opts(Arch::Armv7s)
|
||||
|
@ -23,6 +23,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: opts(Arch::I386)
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "macos".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "windows".to_string(),
|
||||
target_env: "gnu".to_string(),
|
||||
options: options,
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "dragonfly".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "x86".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_env: "gnu".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,16 @@ pub fn opts() -> TargetOptions {
|
||||
morestack: true,
|
||||
linker_is_gnu: true,
|
||||
has_rpath: true,
|
||||
pre_link_args: vec!(
|
||||
// GNU-style linkers will use this to omit linking to libraries which
|
||||
// don't actually fulfill any relocations, but only for libraries which
|
||||
// follow this flag. Thus, use it before specifying libraries to link to.
|
||||
pre_link_args: vec![
|
||||
// We want to be able to strip as much executable code as possible
|
||||
// from the linker command line, and this flag indicates to the
|
||||
// linker that it can avoid linking in dynamic libraries that don't
|
||||
// actually satisfy any symbols up to that point (as with many other
|
||||
// resolutions the linker does). This option only applies to all
|
||||
// following libraries so we're sure to pass it as one of the first
|
||||
// arguments.
|
||||
"-Wl,--as-needed".to_string(),
|
||||
),
|
||||
],
|
||||
position_independent_executables: true,
|
||||
.. Default::default()
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "mips".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_env: "gnu".to_string(),
|
||||
options: super::linux_base::opts()
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "mips".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_env: "gnu".to_string(),
|
||||
|
||||
options: super::linux_base::opts()
|
||||
}
|
||||
|
@ -59,32 +59,6 @@ mod dragonfly_base;
|
||||
mod bitrig_base;
|
||||
mod openbsd_base;
|
||||
|
||||
mod armv7_apple_ios;
|
||||
mod armv7s_apple_ios;
|
||||
mod i386_apple_ios;
|
||||
|
||||
mod arm_linux_androideabi;
|
||||
mod arm_unknown_linux_gnueabi;
|
||||
mod arm_unknown_linux_gnueabihf;
|
||||
mod aarch64_apple_ios;
|
||||
mod aarch64_linux_android;
|
||||
mod aarch64_unknown_linux_gnu;
|
||||
mod i686_apple_darwin;
|
||||
mod i686_pc_windows_gnu;
|
||||
mod i686_unknown_dragonfly;
|
||||
mod i686_unknown_linux_gnu;
|
||||
mod mips_unknown_linux_gnu;
|
||||
mod mipsel_unknown_linux_gnu;
|
||||
mod powerpc_unknown_linux_gnu;
|
||||
mod x86_64_apple_darwin;
|
||||
mod x86_64_apple_ios;
|
||||
mod x86_64_pc_windows_gnu;
|
||||
mod x86_64_unknown_freebsd;
|
||||
mod x86_64_unknown_dragonfly;
|
||||
mod x86_64_unknown_bitrig;
|
||||
mod x86_64_unknown_linux_gnu;
|
||||
mod x86_64_unknown_openbsd;
|
||||
|
||||
/// Everything `rustc` knows about how to compile for a specific target.
|
||||
///
|
||||
/// Every field here must be specified, and has no default value.
|
||||
@ -100,6 +74,8 @@ pub struct Target {
|
||||
pub target_pointer_width: String,
|
||||
/// OS name to use for conditional compilation.
|
||||
pub target_os: String,
|
||||
/// Environment name to use for conditional compilation.
|
||||
pub target_env: String,
|
||||
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm",
|
||||
/// "aarch64", "mips", and "powerpc". "mips" includes "mipsel".
|
||||
pub arch: String,
|
||||
@ -115,14 +91,22 @@ pub struct Target {
|
||||
pub struct TargetOptions {
|
||||
/// Linker to invoke. Defaults to "cc".
|
||||
pub linker: String,
|
||||
/// Linker arguments that are unconditionally passed *before* any user-defined libraries.
|
||||
/// Linker arguments that are unconditionally passed *before* any
|
||||
/// user-defined libraries.
|
||||
pub pre_link_args: Vec<String>,
|
||||
/// Linker arguments that are unconditionally passed *after* any user-defined libraries.
|
||||
/// Linker arguments that are unconditionally passed *after* any
|
||||
/// user-defined libraries.
|
||||
pub post_link_args: Vec<String>,
|
||||
/// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults to "default".
|
||||
/// Objects to link before and after all others, always found within the
|
||||
/// sysroot folder.
|
||||
pub pre_link_objects: Vec<String>,
|
||||
pub post_link_objects: Vec<String>,
|
||||
/// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults
|
||||
/// to "default".
|
||||
pub cpu: String,
|
||||
/// Default target features to pass to LLVM. These features will *always* be passed, and cannot
|
||||
/// be disabled even via `-C`. Corresponds to `llc -mattr=$features`.
|
||||
/// Default target features to pass to LLVM. These features will *always* be
|
||||
/// passed, and cannot be disabled even via `-C`. Corresponds to `llc
|
||||
/// -mattr=$features`.
|
||||
pub features: String,
|
||||
/// Whether dynamic linking is available on this target. Defaults to false.
|
||||
pub dynamic_linking: bool,
|
||||
@ -207,6 +191,8 @@ impl Default for TargetOptions {
|
||||
has_rpath: false,
|
||||
no_compiler_rt: false,
|
||||
position_independent_executables: false,
|
||||
pre_link_objects: Vec::new(),
|
||||
post_link_objects: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -250,6 +236,8 @@ impl Target {
|
||||
target_pointer_width: get_req_field("target-pointer-width"),
|
||||
arch: get_req_field("arch"),
|
||||
target_os: get_req_field("os"),
|
||||
target_env: obj.find("env").and_then(|s| s.as_string())
|
||||
.map(|s| s.to_string()).unwrap_or(String::new()),
|
||||
options: Default::default(),
|
||||
};
|
||||
|
||||
@ -329,6 +317,7 @@ impl Target {
|
||||
macro_rules! load_specific {
|
||||
( $($name:ident),+ ) => (
|
||||
{
|
||||
$(mod $name;)*
|
||||
let target = target.replace("-", "_");
|
||||
if false { }
|
||||
$(
|
||||
@ -358,6 +347,7 @@ impl Target {
|
||||
arm_unknown_linux_gnueabi,
|
||||
arm_unknown_linux_gnueabihf,
|
||||
aarch64_unknown_linux_gnu,
|
||||
x86_64_unknown_linux_musl,
|
||||
|
||||
arm_linux_androideabi,
|
||||
aarch64_linux_android,
|
||||
|
@ -21,6 +21,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "32".to_string(),
|
||||
arch: "powerpc".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_env: "gnu".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "macos".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "ios".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: opts(Arch::X86_64)
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "windows".to_string(),
|
||||
target_env: "gnu".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "bitrig".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "dragonfly".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "freebsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_env: "gnu".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
84
src/librustc_back/target/x86_64_unknown_linux_musl.rs
Normal file
84
src/librustc_back/target/x86_64_unknown_linux_musl.rs
Normal file
@ -0,0 +1,84 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut base = super::linux_base::opts();
|
||||
base.cpu = "x86-64".to_string();
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
|
||||
// Make sure that the linker/gcc really don't pull in anything, including
|
||||
// default objects, libs, etc.
|
||||
base.pre_link_args.push("-nostdlib".to_string());
|
||||
base.pre_link_args.push("-static".to_string());
|
||||
|
||||
// At least when this was tested, the linker would not add the
|
||||
// `GNU_EH_FRAME` program header to executables generated, which is required
|
||||
// when unwinding to locate the unwinding information. I'm not sure why this
|
||||
// argument is *not* necessary for normal builds, but it can't hurt!
|
||||
base.pre_link_args.push("-Wl,--eh-frame-hdr".to_string());
|
||||
|
||||
// There's a whole bunch of circular dependencies when dealing with MUSL
|
||||
// unfortunately. To put this in perspective libc is statically linked to
|
||||
// liblibc and libunwind is statically linked to libstd:
|
||||
//
|
||||
// * libcore depends on `fmod` which is in libc (transitively in liblibc).
|
||||
// liblibc, however, depends on libcore.
|
||||
// * compiler-rt has personality symbols that depend on libunwind, but
|
||||
// libunwind is in libstd which depends on compiler-rt.
|
||||
//
|
||||
// Recall that linkers discard libraries and object files as much as
|
||||
// possible, and with all the static linking and archives flying around with
|
||||
// MUSL the linker is super aggressively stripping out objects. For example
|
||||
// the first case has fmod stripped from liblibc (it's in its own object
|
||||
// file) so it's not there when libcore needs it. In the second example all
|
||||
// the unused symbols from libunwind are stripped (each is in its own object
|
||||
// file in libstd) before we end up linking compiler-rt which depends on
|
||||
// those symbols.
|
||||
//
|
||||
// To deal with these circular dependencies we just force the compiler to
|
||||
// link everything as a group, not stripping anything out until everything
|
||||
// is processed. The linker will still perform a pass to strip out object
|
||||
// files but it won't do so until all objects/archives have been processed.
|
||||
base.pre_link_args.push("-Wl,-(".to_string());
|
||||
base.post_link_args.push("-Wl,-)".to_string());
|
||||
|
||||
// When generating a statically linked executable there's generally some
|
||||
// small setup needed which is listed in these files. These are provided by
|
||||
// a musl toolchain and are linked by default by the `musl-gcc` script. Note
|
||||
// that `gcc` also does this by default, it just uses some different files.
|
||||
//
|
||||
// Each target directory for musl has these object files included in it so
|
||||
// they'll be included from there.
|
||||
base.pre_link_objects.push("crt1.o".to_string());
|
||||
base.pre_link_objects.push("crti.o".to_string());
|
||||
base.post_link_objects.push("crtn.o".to_string());
|
||||
|
||||
// MUSL support doesn't currently include dynamic linking, so there's no
|
||||
// need for dylibs or rpath business. Additionally `-pie` is incompatible
|
||||
// with `-static`, so we can't pass `-pie`.
|
||||
base.dynamic_linking = false;
|
||||
base.has_rpath = false;
|
||||
base.position_independent_executables = false;
|
||||
|
||||
Target {
|
||||
data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
|
||||
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
|
||||
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
|
||||
llvm_target: "x86_64-unknown-linux-musl".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_env: "musl".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ pub fn target() -> Target {
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "openbsd".to_string(),
|
||||
target_env: "".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
@ -794,13 +794,21 @@ fn link_natively(sess: &Session, trans: &CrateTranslation, dylib: bool,
|
||||
let pname = get_cc_prog(sess);
|
||||
let mut cmd = Command::new(&pname[..]);
|
||||
|
||||
let root = sess.target_filesearch(PathKind::Native).get_lib_path();
|
||||
cmd.args(&sess.target.target.options.pre_link_args);
|
||||
for obj in &sess.target.target.options.pre_link_objects {
|
||||
cmd.arg(root.join(obj));
|
||||
}
|
||||
|
||||
link_args(&mut cmd, sess, dylib, tmpdir.path(),
|
||||
trans, obj_filename, out_filename);
|
||||
cmd.args(&sess.target.target.options.post_link_args);
|
||||
if !sess.target.target.options.no_compiler_rt {
|
||||
cmd.arg("-lcompiler-rt");
|
||||
}
|
||||
for obj in &sess.target.target.options.post_link_objects {
|
||||
cmd.arg(root.join(obj));
|
||||
}
|
||||
cmd.args(&sess.target.target.options.post_link_args);
|
||||
|
||||
if sess.opts.debugging_opts.print_link_args {
|
||||
println!("{:?}", &cmd);
|
||||
|
@ -125,7 +125,9 @@ mod tests {
|
||||
use path::Path;
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(any(windows, target_os = "android"), ignore)] // FIXME #8818, #10379
|
||||
#[cfg_attr(any(windows,
|
||||
target_os = "android", // FIXME #10379
|
||||
target_env = "musl"), ignore)]
|
||||
fn test_loading_cosine() {
|
||||
// The math library does not need to be loaded since it is already
|
||||
// statically linked in
|
||||
|
@ -97,10 +97,15 @@ pub type _Unwind_Exception_Cleanup_Fn =
|
||||
extern "C" fn(unwind_code: _Unwind_Reason_Code,
|
||||
exception: *mut _Unwind_Exception);
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
#[cfg(any(all(target_os = "linux", not(target_env = "musl")),
|
||||
target_os = "freebsd"))]
|
||||
#[link(name = "gcc_s")]
|
||||
extern {}
|
||||
|
||||
#[cfg(all(target_os = "linux", target_env = "musl", not(test)))]
|
||||
#[link(name = "unwind", kind = "static")]
|
||||
extern {}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "openbsd"))]
|
||||
#[link(name = "gcc")]
|
||||
extern {}
|
||||
|
@ -24,7 +24,7 @@ extern {}
|
||||
//
|
||||
// On Linux, librt and libdl are indirect dependencies via std,
|
||||
// and binutils 2.22+ won't add them automatically
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
|
||||
#[link(name = "dl")]
|
||||
#[link(name = "pthread")]
|
||||
extern {}
|
||||
|
@ -342,7 +342,10 @@ fn min_stack_size(attr: *const libc::pthread_attr_t) -> usize {
|
||||
static mut __pthread_get_minstack: Option<F> = None;
|
||||
|
||||
INIT.call_once(|| {
|
||||
let lib = DynamicLibrary::open(None).unwrap();
|
||||
let lib = match DynamicLibrary::open(None) {
|
||||
Ok(l) => l,
|
||||
Err(..) => return,
|
||||
};
|
||||
unsafe {
|
||||
if let Ok(f) = lib.symbol("__pthread_get_minstack") {
|
||||
__pthread_get_minstack = Some(mem::transmute::<*const (), F>(f));
|
||||
|
@ -82,7 +82,8 @@ mod inner {
|
||||
// OpenBSD provide it via libc
|
||||
#[cfg(not(any(target_os = "android",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd")))]
|
||||
target_os = "openbsd",
|
||||
target_env = "musl")))]
|
||||
#[link(name = "rt")]
|
||||
extern {}
|
||||
|
||||
|
@ -356,6 +356,7 @@ mod imp {
|
||||
use sys_common::thread_local as os;
|
||||
|
||||
extern {
|
||||
#[linkage = "extern_weak"]
|
||||
static __dso_handle: *mut u8;
|
||||
#[linkage = "extern_weak"]
|
||||
static __cxa_thread_atexit_impl: *const ();
|
||||
|
@ -101,8 +101,8 @@ impl Noise2DContext {
|
||||
|
||||
fn main() {
|
||||
let symbols = [' ', '░', '▒', '▓', '█', '█'];
|
||||
let mut pixels = [0f32; 256*256];
|
||||
let n2d = Noise2DContext::new();
|
||||
let mut pixels = Box::new([0f32; 256*256]);
|
||||
let n2d = Box::new(Noise2DContext::new());
|
||||
|
||||
for _ in 0..100 {
|
||||
for y in 0..256 {
|
||||
|
@ -50,17 +50,17 @@ use std::ptr::copy;
|
||||
use std::thread;
|
||||
|
||||
struct Tables {
|
||||
table8: [u8; 1 << 8],
|
||||
table16: [u16; 1 << 16]
|
||||
table8: Box<[u8; 1 << 8]>,
|
||||
table16: Box<[u16; 1 << 16]>,
|
||||
}
|
||||
|
||||
impl Tables {
|
||||
fn new() -> Tables {
|
||||
let mut table8 = [0;1 << 8];
|
||||
let mut table8 = Box::new([0;1 << 8]);
|
||||
for (i, v) in table8.iter_mut().enumerate() {
|
||||
*v = Tables::computed_cpl8(i as u8);
|
||||
}
|
||||
let mut table16 = [0;1 << 16];
|
||||
let mut table16 = Box::new([0;1 << 16]);
|
||||
for (i, v) in table16.iter_mut().enumerate() {
|
||||
*v = (table8[i & 255] as u16) << 8 |
|
||||
table8[i >> 8] as u16;
|
||||
|
@ -12,6 +12,7 @@
|
||||
// aux-build:issue-13560-2.rs
|
||||
// aux-build:issue-13560-3.rs
|
||||
// ignore-stage1
|
||||
// ignore-musl
|
||||
|
||||
// Regression test for issue #13560, the test itself is all in the dependent
|
||||
// libraries. The fail which previously failed to compile is the one numbered 3.
|
||||
|
@ -11,6 +11,7 @@
|
||||
// aux-build:issue-12133-rlib.rs
|
||||
// aux-build:issue-12133-dylib.rs
|
||||
// aux-build:issue-12133-dylib2.rs
|
||||
// ignore-musl
|
||||
|
||||
// pretty-expanded FIXME #23616
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
// aux-build:linkage-visibility.rs
|
||||
// ignore-android: FIXME(#10379)
|
||||
// ignore-windows: std::dynamic_lib does not work on Windows well
|
||||
// ignore-musl
|
||||
|
||||
#![feature(std_misc)]
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
// ignore-ios
|
||||
// ignore-dragonfly
|
||||
// ignore-bitrig
|
||||
// ignore-musl
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
// Test accessing external items from multiple compilation units.
|
||||
|
||||
extern crate sepcomp_extern_lib;
|
||||
|
||||
#[link(name = "sepcomp_extern_lib")]
|
||||
extern {
|
||||
#[allow(ctypes)]
|
||||
fn foo() -> usize;
|
||||
|
Loading…
Reference in New Issue
Block a user