[llvm] r211804 - Fix the new LTOCodeGenerator setup in gold to parse options before using MAttrs.

Tom Roeder tmroeder at google.com
Thu Jun 26 13:43:27 PDT 2014


Author: tmroeder
Date: Thu Jun 26 15:43:27 2014
New Revision: 211804

URL: http://llvm.org/viewvc/llvm-project?rev=211804&view=rev
Log:
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.

Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=211804&r1=211803&r2=211804&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Jun 26 15:43:27 2014
@@ -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);
 





More information about the llvm-commits mailing list