mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
Add PNaCl target info to the makefile target cfgs and initialize the PNaCl target
machine if available.
This commit is contained in:
parent
f150c178ea
commit
0442be8e1c
9
configure
vendored
9
configure
vendored
@ -616,6 +616,7 @@ valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path (de
|
||||
valopt i686-linux-android-ndk "" "i686-linux-android NDK standalone path"
|
||||
valopt arm-linux-androideabi-ndk "" "arm-linux-androideabi NDK standalone path"
|
||||
valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
|
||||
valopt nacl-cross-path "" "NaCl SDK path (Pepper Canary is recommended). Must be absolute!"
|
||||
valopt release-channel "dev" "the name of the release channel to build"
|
||||
valopt musl-root "/usr/local" "MUSL root installation directory"
|
||||
|
||||
@ -1147,7 +1148,12 @@ do
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
*-unknown-nacl)
|
||||
if [ -z "$CFG_NACL_CROSS_PATH" ]
|
||||
then
|
||||
err "I need the NaCl SDK path! (use --nacl-cross-path)"
|
||||
fi
|
||||
;;
|
||||
arm-apple-darwin)
|
||||
if [ $CFG_OSTYPE != apple-darwin ]
|
||||
then
|
||||
@ -1749,6 +1755,7 @@ putvar CFG_DISABLE_MANAGE_SUBMODULES
|
||||
putvar CFG_AARCH64_LINUX_ANDROID_NDK
|
||||
putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
|
||||
putvar CFG_I686_LINUX_ANDROID_NDK
|
||||
putvar CFG_NACL_CROSS_PATH
|
||||
putvar CFG_MANDIR
|
||||
putvar CFG_USING_LIBCPP
|
||||
|
||||
|
40
mk/cfg/le32-unknown-nacl.mk
Normal file
40
mk/cfg/le32-unknown-nacl.mk
Normal file
@ -0,0 +1,40 @@
|
||||
# le32-unknown-nacl (portable, PNaCl)
|
||||
ifneq ($(CFG_NACL_CROSS_PATH),)
|
||||
|
||||
CC_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool cc)
|
||||
CXX_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool c++)
|
||||
CPP_le32-unknown-nacl=$(CXX_le32-unknown-nacl) -E
|
||||
AR_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool ar)
|
||||
|
||||
CFG_PNACL_TOOLCHAIN := $(abspath $(dir $(AR_le32-unknown-nacl)/../))
|
||||
|
||||
# Note: pso's aren't supported by PNaCl.
|
||||
CFG_LIB_NAME_le32-unknown-nacl=lib$(1).pso
|
||||
CFG_STATIC_LIB_NAME_le32-unknown-nacl=lib$(1).a
|
||||
CFG_LIB_GLOB_le32-unknown-nacl=lib$(1)-*.pso
|
||||
CFG_LIB_DSYM_GLOB_le32-unknown-nacl=lib$(1)-*.dylib.dSYM
|
||||
CFG_GCCISH_CFLAGS_le32-unknown-nacl := -Wall -Wno-unused-variable -Wno-unused-value $(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --cflags) -D_YUGA_LITTLE_ENDIAN=1 -D_YUGA_BIG_ENDIAN=0
|
||||
CFG_GCCISH_CXXFLAGS_le32-unknown-nacl := -stdlib=libc++ $(CFG_GCCISH_CFLAGS_le32-unknown-nacl)
|
||||
CFG_GCCISH_LINK_FLAGS_le32-unknown-nacl := -static -pthread -lm
|
||||
CFG_GCCISH_DEF_FLAG_le32-unknown-nacl := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_le32-unknown-nacl := -Wl,-no-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_le32-unknown-nacl :=
|
||||
CFG_DEF_SUFFIX_le32-unknown-nacl := .le32.nacl.def
|
||||
CFG_INSTALL_NAME_le32-unknown-nacl =
|
||||
CFG_EXE_SUFFIX_le32-unknown-nacl = .pexe
|
||||
CFG_WINDOWSY_le32-unknown-nacl :=
|
||||
CFG_UNIXY_le32-unknown-nacl := 1
|
||||
CFG_NACLY_le32-unknown-nacl := 1
|
||||
CFG_PATH_MUNGE_le32-unknown-nacl := true
|
||||
CFG_LDPATH_le32-unknown-nacl :=
|
||||
CFG_RUN_le32-unknown-nacl=$(2)
|
||||
CFG_RUN_TARG_le32-unknown-nacl=$(call CFG_RUN_le32-unknown-nacl,,$(2))
|
||||
RUSTC_FLAGS_le32-unknown-nacl:=
|
||||
RUSTC_CROSS_FLAGS_le32-unknown-nacl=-L $(CFG_NACL_CROSS_PATH)/lib/pnacl/Release -L $(CFG_PNACL_TOOLCHAIN)/lib/clang/3.7.0/lib/le32-nacl -L $(CFG_PNACL_TOOLCHAIN)/le32-nacl/usr/lib -L $(CFG_PNACL_TOOLCHAIN)/le32-nacl/lib
|
||||
CFG_GNU_TRIPLE_le32-unknown-nacl := le32-unknown-nacl
|
||||
|
||||
# strdup isn't defined unless -std=gnu++11 is used :/
|
||||
LLVM_FILTER_CXXFLAGS_le32-unknown-nacl := -std=c++11
|
||||
LLVM_EXTRA_CXXFLAGS_le32-unknown-nacl := -std=gnu++11
|
||||
|
||||
endif
|
@ -276,7 +276,7 @@ endif
|
||||
# LLVM macros
|
||||
######################################################################
|
||||
|
||||
LLVM_OPTIONAL_COMPONENTS=x86 arm aarch64 mips powerpc
|
||||
LLVM_OPTIONAL_COMPONENTS=x86 arm aarch64 mips powerpc pnacl
|
||||
LLVM_REQUIRED_COMPONENTS=ipo bitreader bitwriter linker asmparser mcjit \
|
||||
interpreter instrumentation
|
||||
|
||||
|
@ -2011,32 +2011,6 @@ extern {
|
||||
pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef;
|
||||
pub fn LLVMIsAConstantInt(value_ref: ValueRef) -> ValueRef;
|
||||
|
||||
pub fn LLVMInitializeX86TargetInfo();
|
||||
pub fn LLVMInitializeX86Target();
|
||||
pub fn LLVMInitializeX86TargetMC();
|
||||
pub fn LLVMInitializeX86AsmPrinter();
|
||||
pub fn LLVMInitializeX86AsmParser();
|
||||
pub fn LLVMInitializeARMTargetInfo();
|
||||
pub fn LLVMInitializeARMTarget();
|
||||
pub fn LLVMInitializeARMTargetMC();
|
||||
pub fn LLVMInitializeARMAsmPrinter();
|
||||
pub fn LLVMInitializeARMAsmParser();
|
||||
pub fn LLVMInitializeAArch64TargetInfo();
|
||||
pub fn LLVMInitializeAArch64Target();
|
||||
pub fn LLVMInitializeAArch64TargetMC();
|
||||
pub fn LLVMInitializeAArch64AsmPrinter();
|
||||
pub fn LLVMInitializeAArch64AsmParser();
|
||||
pub fn LLVMInitializeMipsTargetInfo();
|
||||
pub fn LLVMInitializeMipsTarget();
|
||||
pub fn LLVMInitializeMipsTargetMC();
|
||||
pub fn LLVMInitializeMipsAsmPrinter();
|
||||
pub fn LLVMInitializeMipsAsmParser();
|
||||
pub fn LLVMInitializePowerPCTargetInfo();
|
||||
pub fn LLVMInitializePowerPCTarget();
|
||||
pub fn LLVMInitializePowerPCTargetMC();
|
||||
pub fn LLVMInitializePowerPCAsmPrinter();
|
||||
pub fn LLVMInitializePowerPCAsmParser();
|
||||
|
||||
pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool;
|
||||
pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
|
||||
CPU: *const c_char,
|
||||
@ -2144,6 +2118,53 @@ extern {
|
||||
pub fn LLVMRustGetModuleDataLayout(M: ModuleRef) -> TargetDataRef;
|
||||
}
|
||||
|
||||
#[cfg(have_component_x86)]
|
||||
extern {
|
||||
pub fn LLVMInitializeX86TargetInfo();
|
||||
pub fn LLVMInitializeX86Target();
|
||||
pub fn LLVMInitializeX86TargetMC();
|
||||
pub fn LLVMInitializeX86AsmPrinter();
|
||||
pub fn LLVMInitializeX86AsmParser();
|
||||
}
|
||||
#[cfg(have_component_arm)]
|
||||
extern {
|
||||
pub fn LLVMInitializeARMTargetInfo();
|
||||
pub fn LLVMInitializeARMTarget();
|
||||
pub fn LLVMInitializeARMTargetMC();
|
||||
pub fn LLVMInitializeARMAsmPrinter();
|
||||
pub fn LLVMInitializeARMAsmParser();
|
||||
}
|
||||
#[cfg(have_component_aarch64)]
|
||||
extern {
|
||||
pub fn LLVMInitializeAArch64TargetInfo();
|
||||
pub fn LLVMInitializeAArch64Target();
|
||||
pub fn LLVMInitializeAArch64TargetMC();
|
||||
pub fn LLVMInitializeAArch64AsmPrinter();
|
||||
pub fn LLVMInitializeAArch64AsmParser();
|
||||
}
|
||||
#[cfg(have_component_mips)]
|
||||
extern {
|
||||
pub fn LLVMInitializeMipsTargetInfo();
|
||||
pub fn LLVMInitializeMipsTarget();
|
||||
pub fn LLVMInitializeMipsTargetMC();
|
||||
pub fn LLVMInitializeMipsAsmPrinter();
|
||||
pub fn LLVMInitializeMipsAsmParser();
|
||||
}
|
||||
#[cfg(have_component_powerpc)]
|
||||
extern {
|
||||
pub fn LLVMInitializePowerPCTargetInfo();
|
||||
pub fn LLVMInitializePowerPCTarget();
|
||||
pub fn LLVMInitializePowerPCTargetMC();
|
||||
pub fn LLVMInitializePowerPCAsmPrinter();
|
||||
pub fn LLVMInitializePowerPCAsmParser();
|
||||
}
|
||||
#[cfg(have_component_pnacl)]
|
||||
extern {
|
||||
pub fn LLVMInitializePNaClTargetInfo();
|
||||
pub fn LLVMInitializePNaClTarget();
|
||||
pub fn LLVMInitializePNaClTargetMC();
|
||||
}
|
||||
|
||||
// LLVM requires symbols from this library, but apparently they're not printed
|
||||
// during llvm-config?
|
||||
#[cfg(windows)]
|
||||
@ -2357,6 +2378,20 @@ pub fn initialize_available_targets() {
|
||||
init_target!(have_component_aarch64 AArch64);
|
||||
init_target!(have_component_arm ARM);
|
||||
init_target!(have_component_x86 X86);
|
||||
|
||||
// PNaCl doesn't provide some of the optional target components, so we
|
||||
// manually initialize it here.
|
||||
#[cfg(have_component_pnacl)]
|
||||
fn init_pnacl() {
|
||||
unsafe {
|
||||
LLVMInitializePNaClTargetInfo();
|
||||
LLVMInitializePNaClTarget();
|
||||
LLVMInitializePNaClTargetMC();
|
||||
}
|
||||
}
|
||||
#[cfg(not(have_component_pnacl))]
|
||||
fn init_pnacl() { }
|
||||
init_pnacl();
|
||||
}
|
||||
|
||||
// The module containing the native LLVM dependencies, generated by the build system
|
||||
|
Loading…
Reference in New Issue
Block a user