[llvm-branch-commits] [llvm-branch] r73785 - /llvm/branches/Apple/Bender/tools/lto/LTOCodeGenerator.cpp
Bill Wendling
isanbard at gmail.com
Fri Jun 19 15:02:11 PDT 2009
Author: void
Date: Fri Jun 19 17:02:11 2009
New Revision: 73785
URL: http://llvm.org/viewvc/llvm-project?rev=73785&view=rev
Log:
--- Merging r72816 into '.':
U tools/lto/LTOCodeGenerator.cpp
Modified:
llvm/branches/Apple/Bender/tools/lto/LTOCodeGenerator.cpp
Modified: llvm/branches/Apple/Bender/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Bender/tools/lto/LTOCodeGenerator.cpp?rev=73785&r1=73784&r2=73785&view=diff
==============================================================================
--- llvm/branches/Apple/Bender/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/branches/Apple/Bender/tools/lto/LTOCodeGenerator.cpp Fri Jun 19 17:02:11 2009
@@ -291,6 +291,20 @@
if ( march == NULL )
return true;
+ // The relocation model is actually a static member of TargetMachine
+ // and needs to be set before the TargetMachine is instantiated.
+ switch( _codeModel ) {
+ case LTO_CODEGEN_PIC_MODEL_STATIC:
+ TargetMachine::setRelocationModel(Reloc::Static);
+ break;
+ case LTO_CODEGEN_PIC_MODEL_DYNAMIC:
+ TargetMachine::setRelocationModel(Reloc::PIC_);
+ break;
+ case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC:
+ TargetMachine::setRelocationModel(Reloc::DynamicNoPIC);
+ break;
+ }
+
// construct LTModule, hand over ownership of module and target
std::string FeatureStr =
getFeatureString(_linker.getModule()->getTargetTriple().c_str());
@@ -350,19 +364,6 @@
if ( _target->getTargetAsmInfo()->doesSupportExceptionHandling() )
llvm::ExceptionHandling = true;
- // set codegen model
- switch( _codeModel ) {
- case LTO_CODEGEN_PIC_MODEL_STATIC:
- _target->setRelocationModel(Reloc::Static);
- break;
- case LTO_CODEGEN_PIC_MODEL_DYNAMIC:
- _target->setRelocationModel(Reloc::PIC_);
- break;
- case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC:
- _target->setRelocationModel(Reloc::DynamicNoPIC);
- break;
- }
-
// if options were requested, set them
if ( !_codegenOptions.empty() )
cl::ParseCommandLineOptions(_codegenOptions.size(),
More information about the llvm-branch-commits
mailing list