[PATCH] D39353: [lld] Fix --exclude-libs broken when --whole-archive is used

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 16:39:10 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/Driver.cpp:986-987
+    // For archives check if they are in the -exclude-libs list.
+    if (auto *F = dyn_cast<ArchiveFile>(File)) {
       if (All || Libs.count(path::filename(F->getName())))
         for (SymbolBody *Sym : F->getSymbols())
----------------
I'd define a function

  static StringRef getArchiveName(InputFile *File) {
    if (isa<ArchiveFile>(File))
      return File_>getName();
    return File->ArchiveName;
  }

so that I can write

  for (InputFile *File :Files)
    if ((All && isa<ArchiveFile>(File)) || Libs.count(path::filename(getArchiveName(File)))
      for (SymbolBody *Sym : F->getSymbols()
        if (!Sym->isLocal())
          Sym->symbol()->VersionId = VER_NDX_LOCAL;


Repository:
  rL LLVM

https://reviews.llvm.org/D39353





More information about the llvm-commits mailing list