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

Rui Ueyama ruiu at google.com
Mon Jun 29 16:32:44 PDT 2015


Thank you for doing this. This looks much nicer.

On Mon, Jun 29, 2015 at 4:26 PM, Peter Collingbourne <peter at pcc.me.uk>
wrote:

> 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();
>  }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150629/f0fa7fdb/attachment.html>


More information about the llvm-commits mailing list