[lld] r313372 - Keep some relocations with undefined weak symbols.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 15:26:06 PDT 2017


On Fri, Sep 15, 2017 at 2:58 PM, Rafael Avila de Espindola via
llvm-commits <llvm-commits at lists.llvm.org> wrote:
> BTW, I have tried to change this to always create a dynamic symbol table
> first and remove it in removeUnusedSyntheticSections if empty.
>
> A change is that we would have a dynamic symbol table on otherwise
> static programs if they had an undefined weak symbol. As far as I can
> tell, that is harmless.
>
> An annoying case is what to do with _DYNAMIC. The current patch has two
> passes over the symbols. First checking if we need anything in the
> dynamic symbol table. After that pass removeUnusedSyntheticSections can
> remove the dynamic sections (.dynsym, .dynamic, etc) and we can decide
> if _DYNAMIC should be added to the staic symbol table.
>
> A wip patch is attached. Does anyone think this is a good idea?
>
> And yet another option is to always have a .dynsym table. The extra cost
> on static binaries would be really small, so this is tempting.
>

This last option is my favourite one. The impact in size should be
really negligible.
If there are objections, we should try to go for your WIP patch, but
I'm under the impression the benefits introduced are not worth the
complexity added.

Thanks for digging into this,

--
Davide


More information about the llvm-commits mailing list