Move the processing of the command line options to right before we create the
TargetMachine instead of after.
<rdar://problem/
13468287>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182611
91177308-0d34-0410-b5e6-
96231b3b80d8
return _nativeObjectFile->getBufferStart();
}
return _nativeObjectFile->getBufferStart();
}
-bool LTOCodeGenerator::determineTarget(std::string& errMsg) {
+bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
if (_target != NULL)
return false;
if (_target != NULL)
return false;
+ // if options were requested, set them
+ if (!_codegenOptions.empty())
+ cl::ParseCommandLineOptions(_codegenOptions.size(),
+ const_cast<char **>(&_codegenOptions[0]));
+
std::string TripleStr = _linker.getModule()->getTargetTriple();
if (TripleStr.empty())
TripleStr = sys::getDefaultTargetTriple();
std::string TripleStr = _linker.getModule()->getTargetTriple();
if (TripleStr.empty())
TripleStr = sys::getDefaultTargetTriple();
Module* mergedModule = _linker.getModule();
Module* mergedModule = _linker.getModule();
- // if options were requested, set them
- if (!_codegenOptions.empty())
- cl::ParseCommandLineOptions(_codegenOptions.size(),
- const_cast<char **>(&_codegenOptions[0]));
-
- // mark which symbols can not be internalized
+ // Mark which symbols can not be internalized
this->applyScopeRestrictions();
// Instantiate the pass manager to organize the passes.
this->applyScopeRestrictions();
// Instantiate the pass manager to organize the passes.
// Enabling internalize here would use its AllButMain variant. It
// keeps only main if it exists and does nothing for libraries. Instead
// we create the pass ourselves with the symbol list provided by the linker.
// Enabling internalize here would use its AllButMain variant. It
// keeps only main if it exists and does nothing for libraries. Instead
// we create the pass ourselves with the symbol list provided by the linker.
PassManagerBuilder().populateLTOPassManager(passes,
/*Internalize=*/false,
!DisableInline,
DisableGVNLoadPRE);
PassManagerBuilder().populateLTOPassManager(passes,
/*Internalize=*/false,
!DisableInline,
DisableGVNLoadPRE);
// Make sure everything is still good.
passes.add(createVerifierPass());
// Make sure everything is still good.
passes.add(createVerifierPass());