From: Tom Roeder Date: Thu, 26 Jun 2014 20:43:27 +0000 (+0000) Subject: Fix the new LTOCodeGenerator setup in gold to parse options before using MAttrs. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b508119fb65167ad2062eb5bca810414485ddd35;p=platform%2Fupstream%2Fllvm.git Fix the new LTOCodeGenerator setup in gold to parse options before using MAttrs. This fixes a regression that made clang -flto -Wl,--plugin-opt=-mattr=+aes not pass the "+aes" option to the LTOCodeGenerator attributes. llvm-svn: 211804 --- diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 3c2da94..c3ae5a6 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -234,15 +234,6 @@ ld_plugin_status onload(ld_plugin_tv *tv) { InitializeAllAsmParsers(); InitializeAllAsmPrinters(); CodeGen = new LTOCodeGenerator(); - if (MAttrs.size()) { - std::string Attrs; - for (unsigned I = 0; I < MAttrs.size(); ++I) { - if (I > 0) - Attrs.append(","); - Attrs.append(MAttrs[I]); - } - CodeGen->setAttr(Attrs.c_str()); - } // Pass through extra options to the code generator. if (!options::extra.empty()) { @@ -253,6 +244,16 @@ ld_plugin_status onload(ld_plugin_tv *tv) { } CodeGen->parseCodeGenDebugOptions(); + if (MAttrs.size()) { + std::string Attrs; + for (unsigned I = 0; I < MAttrs.size(); ++I) { + if (I > 0) + Attrs.append(","); + Attrs.append(MAttrs[I]); + } + CodeGen->setAttr(Attrs.c_str()); + } + TargetOpts = InitTargetOptionsFromCodeGenFlags(); CodeGen->setTargetOptions(TargetOpts);