[lld] r241020 - COFF: Use LTOModule::getLinkerOpts() instead of reading the linker directives ourselves.

Peter Collingbourne peter at pcc.me.uk
Mon Jun 29 16:26:29 PDT 2015


Author: pcc
Date: Mon Jun 29 18:26:28 2015
New Revision: 241020

URL: http://llvm.org/viewvc/llvm-project?rev=241020&view=rev
Log:
COFF: Use LTOModule::getLinkerOpts() instead of reading the linker directives ourselves.

Modified:
    lld/trunk/COFF/InputFiles.cpp

Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=241020&r1=241019&r2=241020&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Mon Jun 29 18:26:28 2015
@@ -292,33 +292,10 @@ std::error_code BitcodeFile::parse() {
       bool Replaceable = (SymbolDef == LTO_SYMBOL_DEFINITION_TENTATIVE ||
                           (Attrs & LTO_SYMBOL_COMDAT));
       SymbolBodies.push_back(new (Alloc) DefinedBitcode(SymName, Replaceable));
-
-      const llvm::GlobalValue *GV = M->getSymbolGV(I);
-      if (GV && GV->hasDLLExportStorageClass()) {
-        Directives += " /export:";
-        Directives += SymName;
-        if (!GV->getValueType()->isFunctionTy())
-          Directives += ",data";
-      }
-    }
-  }
-
-  // Extract any linker directives from the bitcode file, which are represented
-  // as module flags with the key "Linker Options".
-  llvm::SmallVector<llvm::Module::ModuleFlagEntry, 8> Flags;
-  M->getModule().getModuleFlagsMetadata(Flags);
-  for (auto &&Flag : Flags) {
-    if (Flag.Key->getString() != "Linker Options")
-      continue;
-
-    for (llvm::Metadata *Op : cast<llvm::MDNode>(Flag.Val)->operands()) {
-      for (llvm::Metadata *InnerOp : cast<llvm::MDNode>(Op)->operands()) {
-        Directives += " ";
-        Directives += cast<llvm::MDString>(InnerOp)->getString();
-      }
     }
   }
 
+  Directives = M->getLinkerOpts();
   return std::error_code();
 }
 





More information about the llvm-commits mailing list