]> git.lizzy.rs Git - rust.git/commitdiff
Only initialize targets that are actually supported / linked to in RustWrapper
authorZack Corr <zack@z0w0.me>
Sat, 21 Jul 2012 07:20:45 +0000 (17:20 +1000)
committerGraydon Hoare <graydon@mozilla.com>
Wed, 25 Jul 2012 00:11:13 +0000 (17:11 -0700)
src/rustllvm/RustWrapper.cpp
src/rustllvm/rustllvm.def.in

index 6c19a2997575072d6ebf66b9eef5bf35185458c5..8135465b30dc214e4e4d9fbe86e432e461b65840 100644 (file)
@@ -75,6 +75,12 @@ extern "C" bool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src) {
   return true;
 }
 
+void LLVMInitializeX86TargetInfo();
+void LLVMInitializeX86Target();
+void LLVMInitializeX86TargetMC();
+void LLVMInitializeX86AsmPrinter();
+void LLVMInitializeX86AsmParser();
+
 extern "C" bool
 LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
                         LLVMModuleRef M,
@@ -84,10 +90,16 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
                         CodeGenOpt::Level OptLevel,
                        bool EnableSegmentedStacks) {
 
-  InitializeAllTargets();
-  InitializeAllTargetMCs();
-  InitializeAllAsmPrinters();
-  InitializeAllAsmParsers();
+  // Only initialize the platforms supported by Rust here,
+  // because using --llvm-root will have multiple platforms
+  // that rustllvm doesn't actually link to and it's pointless to put target info
+  // into the registry that Rust can not generate machine code for.
+
+  LLVMInitializeX86TargetInfo();
+  LLVMInitializeX86Target();
+  LLVMInitializeX86TargetMC();
+  LLVMInitializeX86AsmPrinter();
+  LLVMInitializeX86AsmParser();
 
   TargetOptions Options;
   Options.NoFramePointerElim = true;
index 8d82d930fd6ffeb75d6e9be704fe6755b297359e..ed3799028d4f2920df270e3ae87cf0e3b1b8f053 100644 (file)
@@ -390,6 +390,8 @@ LLVMInitializeX86Disassembler
 LLVMInitializeX86Disassembler
 LLVMInitializeX86Target
 LLVMInitializeX86Target
+LLVMInitializeX86TargetMC
+LLVMInitializeX86TargetMC
 LLVMInitializeX86TargetInfo
 LLVMInitializeX86TargetInfo
 LLVMInsertBasicBlock