Only initialize targets that are actually supported / linked to in RustWrapper
This commit is contained in:
parent
de5c15edfb
commit
480fa7c00e
2 changed files with 18 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue