[llvm-dev] lld: --start-lib and --end-lib
Rafael Espíndola via llvm-dev
llvm-dev at lists.llvm.org
Wed Apr 6 12:17:31 PDT 2016
On 6 April 2016 at 00:07, Rui Ueyama <ruiu at google.com> wrote:
> I hacked up a patch to support --start-lib and --end-lib in the second way.
> In this patch, I introduced a new notion, LazyObject. That is analogous to
> Archive file type, but that works for a single object file instead of an
> archive file. This patch is +160 and -26 lines, so I can say that it is
> pretty simple.
The description sounds reasonable. Taking a look.
> This is not directly related to --start-lib and --end-lib, but LazyObject
> may be useful for --gc-sections as well. This is the suggestion I got in the
> EuroLLVM 2016 meeting (I'm sorry but I don't remember who his name), but he
> suggested handling all object files as lazy object files for --gc-sections.
> It means by default no object files are linked. The entry point symbol would
> link one object file, and that triggers all used object files to be
> instantiated. I think this is very interesting idea because we don't need to
> do mark-sweep garbage collection to do --gc-sections; instead, everything
> will be linked only when they are needed.
That is a very big change in semantics given static constructors. Even
llvm itself uses static constructors to register passes, so including
a file and then gcing is not the same an not gcing.
More information about the llvm-dev