diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-02 14:36:23 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-02 14:36:23 +0000 |
commit | efa02d53ff5672f3ff1390a9bd1b44d19934a7a4 (patch) | |
tree | d2475beacc84b1186d6eededc0b30bab1beb035f /llvm/tools/lto/lto.cpp | |
parent | 40689dc08f5eab5a7e560be13e22081f20f2c6a5 (diff) | |
download | bcm5719-llvm-efa02d53ff5672f3ff1390a9bd1b44d19934a7a4.tar.gz bcm5719-llvm-efa02d53ff5672f3ff1390a9bd1b44d19934a7a4.zip |
Fix option parsing in the gold plugin.
This was broken when options were moved up in r191680. No test because this is
specific LLVMgold.so/libLTO.so.
Patch by Tom Roeder!
llvm-svn: 191829
Diffstat (limited to 'llvm/tools/lto/lto.cpp')
-rw-r--r-- | llvm/tools/lto/lto.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp index 79967207f55..7bfddcd9ec4 100644 --- a/llvm/tools/lto/lto.cpp +++ b/llvm/tools/lto/lto.cpp @@ -40,6 +40,9 @@ static std::string sLastErrorString; // *** Not thread safe *** static bool initialized = false; +// Holds the command-line option parsing state of the LTO module. +static bool parsedOptions = false; + // Initialize the configured targets if they have not been initialized. static void lto_initialize() { if (!initialized) { @@ -261,6 +264,10 @@ void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, /// that contains the merged contents of all modules added so far. Returns true /// on error (check lto_get_error_message() for details). bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) { + if (!parsedOptions) { + cg->parseCodeGenDebugOptions(); + parsedOptions = true; + } return !cg->writeMergedModules(path, sLastErrorString); } @@ -271,6 +278,10 @@ bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) { /// lto_codegen_compile() is called again. On failure, returns NULL (check /// lto_get_error_message() for details). const void *lto_codegen_compile(lto_code_gen_t cg, size_t *length) { + if (!parsedOptions) { + cg->parseCodeGenDebugOptions(); + parsedOptions = true; + } return cg->compile(length, DisableOpt, DisableInline, DisableGVNLoadPRE, sLastErrorString); } @@ -279,6 +290,10 @@ const void *lto_codegen_compile(lto_code_gen_t cg, size_t *length) { /// native object file. The name of the file is written to name. Returns true on /// error. bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) { + if (!parsedOptions) { + cg->parseCodeGenDebugOptions(); + parsedOptions = true; + } return !cg->compile_to_file(name, DisableOpt, DisableInline, DisableGVNLoadPRE, sLastErrorString); } |