[PATCH] D39353: [lld] Fix --exclude-libs broken when --whole-archive is used
Oleg Ranevskyy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 17:20:57 PDT 2017
iid_iunknown 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())
----------------
ruiu wrote:
> 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;
Thanks Rui!
This one is now fixed.
Please note that the suggested condition
```
if ((All && isa<ArchiveFile>(File)) || Libs.count(path::filename(getArchiveName(File)))
```
is not quite correct as it does not handle the `--exclude-libs ALL --whole-archive` case, so it was modified to produce the expected result.
Repository:
rL LLVM
https://reviews.llvm.org/D39353
More information about the llvm-commits
mailing list