[LLVMdev] Some thought on handling ELF shared libraries in lld

Rafael Espíndola
2015-07-21T14:30:55Z

On 21 July 2015 at 09:34, Dave Bozier <seifsta at gmail.com>
wrote:
> Sounds reasonable. The sstrip tool that performs stripping of the
> section header does state that this makes shared libraries unsuitable
> for static linking. From the documentation:
>
>> A shared-object library stripped in this fashion will still be usable
by the dynamic linker, but not by the static linker.
>
> That said, it should be technically possible to statically link a
> shared library with no section header table if we chose to support
> that use case. Can't you use the symbol indices of dynamic relocations
> to achieve this instead of counting the number of symbols?

It is technically possible. But we have to find the total symbols
early (symbol resolution) and so we would need to do an early scan of
another table just to find that number.

Cheers,
Rafael