[llvm-dev] lld: --start-lib and --end-lib

Rafael EspĂ­ndola via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 6 12:14:02 PDT 2016

On 5 April 2016 at 22:51, Rui Ueyama <ruiu at google.com> wrote:
> Rafael,
> You seems to be the person who added --start-lib and --end-lib to gold (*1),
> so I think you are the best person to ask about it. :)
> What is the intended use case of the options? Do you think we should support
> that in LLD?

It was initially created for cluster builds. Running ar is really fast
if using thin archives, but one still has to copy the files to one
machine to create the archive.

Using --start-lib/--end-lib solves that problem. I find it a neat
feature, but to the best of my knowledge to this day it is only used
within google.

> If we want to support that, then I think we can think of two implementation
> strategies:
>  - Link object files between --start-lib and --end-lib normally and garbage
> collect unused sections, or
>  - create lazy symbols for object files between --start-lib and --end-lib
> and handle just like archive files.
> What do you think?

You have to create lazy symbols. The semantics are not the same given
that some things (static constructors) are not gced.


More information about the llvm-dev mailing list