diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-19 22:54:47 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-19 22:54:47 +0000 |
commit | f38fdf1b612bf9e0a19d8d08d4283baa05334bcb (patch) | |
tree | 8c03896363ff0f9ae017005e51279904afbfc1ab | |
parent | f7b992bdcd05fd6844f96e0431505d0b9c9956f9 (diff) | |
download | llvm-f38fdf1b612bf9e0a19d8d08d4283baa05334bcb.tar.gz llvm-f38fdf1b612bf9e0a19d8d08d4283baa05334bcb.tar.bz2 llvm-f38fdf1b612bf9e0a19d8d08d4283baa05334bcb.tar.xz |
Set gold plugin options in a sane order.
This fixes the processing of --plugin-opt=-jump-table-type=arity.
Nice properties:
* We call InitTargetOptionsFromCodeGenFlags once.
* We call parseCodeGenDebugOptions once.
* It works :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211322 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/gold/gold-plugin.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 2cde5d1c57..bb8b32b814 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -248,9 +248,7 @@ ld_plugin_status onload(ld_plugin_tv *tv) { InitializeAllAsmParsers(); InitializeAllAsmPrinters(); InitializeAllDisassemblers(); - TargetOpts = InitTargetOptionsFromCodeGenFlags(); CodeGen = new LTOCodeGenerator(); - CodeGen->setTargetOptions(TargetOpts); if (MAttrs.size()) { std::string Attrs; for (unsigned I = 0; I < MAttrs.size(); ++I) { @@ -261,6 +259,18 @@ ld_plugin_status onload(ld_plugin_tv *tv) { CodeGen->setAttr(Attrs.c_str()); } + // Pass through extra options to the code generator. + if (!options::extra.empty()) { + for (std::vector<std::string>::iterator it = options::extra.begin(); + it != options::extra.end(); ++it) { + CodeGen->setCodeGenDebugOptions((*it).c_str()); + } + } + + CodeGen->parseCodeGenDebugOptions(); + TargetOpts = InitTargetOptionsFromCodeGenFlags(); + CodeGen->setTargetOptions(TargetOpts); + return LDPS_OK; } @@ -444,14 +454,6 @@ static ld_plugin_status all_symbols_read_hook(void) { if (!options::mcpu.empty()) CodeGen->setCpu(options::mcpu.c_str()); - // Pass through extra options to the code generator. - if (!options::extra.empty()) { - for (std::vector<std::string>::iterator it = options::extra.begin(); - it != options::extra.end(); ++it) { - CodeGen->setCodeGenDebugOptions((*it).c_str()); - } - } - if (options::generate_bc_file != options::BC_NO) { std::string path; if (options::generate_bc_file == options::BC_ONLY) @@ -460,7 +462,6 @@ static ld_plugin_status all_symbols_read_hook(void) { path = options::bc_path; else path = output_name + ".bc"; - CodeGen->parseCodeGenDebugOptions(); std::string Error; if (!CodeGen->writeMergedModules(path.c_str(), Error)) (*message)(LDPL_FATAL, "Failed to write the output file."); @@ -473,7 +474,6 @@ static ld_plugin_status all_symbols_read_hook(void) { std::string ObjPath; { const char *Temp; - CodeGen->parseCodeGenDebugOptions(); std::string Error; if (!CodeGen->compile_to_file(&Temp, /*DisableOpt*/ false, /*DisableInline*/ false, /*DisableGVNLoadPRE*/ false, Error)) |