aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-05-23 21:21:50 +0000
committerBill Wendling <isanbard@gmail.com>2013-05-23 21:21:50 +0000
commit8c18a6fe370f7f1fb3208a12434e862fc5e9b2e6 (patch)
tree8d409871de8533e567a92660571017f276395d92 /tools
parent5a02fc4b5fa0eba4d0875db710400a74ada3b15f (diff)
downloadexternal_llvm-8c18a6fe370f7f1fb3208a12434e862fc5e9b2e6.zip
external_llvm-8c18a6fe370f7f1fb3208a12434e862fc5e9b2e6.tar.gz
external_llvm-8c18a6fe370f7f1fb3208a12434e862fc5e9b2e6.tar.bz2
The command line options need to be processed before we create the TargetMachine.
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
Diffstat (limited to 'tools')
-rw-r--r--tools/lto/LTOCodeGenerator.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index 57e7a2d..8b339ee 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -220,10 +220,15 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg) {
return _nativeObjectFile->getBufferStart();
}
-bool LTOCodeGenerator::determineTarget(std::string& errMsg) {
+bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
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();
@@ -361,12 +366,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
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.
@@ -382,12 +382,11 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
// 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.
- if (!DisableOpt) {
+ if (!DisableOpt)
PassManagerBuilder().populateLTOPassManager(passes,
/*Internalize=*/false,
!DisableInline,
DisableGVNLoadPRE);
- }
// Make sure everything is still good.
passes.add(createVerifierPass());