[PATCH] D38937: [LLD] [COFF] Exclude certain static libraries and object files when exporting all symbols

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 16 00:07:51 PDT 2017


mstorsjo added a comment.

In https://reviews.llvm.org/D38937#898216, @ruiu wrote:

> In https://reviews.llvm.org/D38937#898215, @mstorsjo wrote:
>
> > In https://reviews.llvm.org/D38937#898214, @ruiu wrote:
> >
> > > At this point I feel like we should define a function `bool shouldExport(Defined *Sym)` or something, so that we can move the code to that function.
> >
> >
> > Sounds like a good idea. How do you suggest to handle the exclude `StringSet`s in that case - recreate them in each function invocation? Or have a `static StringSet<> ExcludeSymbols` in the global scope?
>
>
> I don't know if this is a good idea, but since the number of strings you need to check is small, you may be able to just iterate over the list like this?
>
>   for (StringRef S : {"libgcc", "libgcc_s", ...})
>     if (LibName == S)
>       return false;


I feel that would end up pretty unwieldy. Additionally, the set of symbols to exclude is different depending on the architecture.

The symbol/lib/object sets should be easy to encapsulate in a class though - I'll update the diff with such a suggestion.


https://reviews.llvm.org/D38937





More information about the llvm-commits mailing list