diff options
| author | Zack Corr <zack@z0w0.me> | 2012-07-21 17:20:45 +1000 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-07-24 17:11:13 -0700 |
| commit | 480fa7c00e477dc2bdad1f7750b57c128e78f491 (patch) | |
| tree | 1fc632d0e5a7164d1263b0d5dcc0a407a1a7a0a8 /src/rustllvm/RustWrapper.cpp | |
| parent | de5c15edfb0eb44fafb7021b61b51ae2c800b0fd (diff) | |
| download | rust-480fa7c00e477dc2bdad1f7750b57c128e78f491.tar.gz rust-480fa7c00e477dc2bdad1f7750b57c128e78f491.zip | |
Only initialize targets that are actually supported / linked to in RustWrapper
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 6c19a299757..8135465b30d 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -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; |
