<div dir="ltr">I hacked up a patch to support --start-lib and --end-lib in the second way.<div><br></div><div><a href="http://reviews.llvm.org/D18814">http://reviews.llvm.org/D18814</a><br></div><div><br></div><div>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.</div><div><br></div><div>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.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 5, 2016 at 7:51 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Rafael,<div><br></div><div>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. :)</div><div><br></div><div>What is the intended use case of the options? Do you think we should support that in LLD?</div><div><br></div><div>If we want to support that, then I think we can think of two implementation strategies:</div><div><br></div><div> - Link object files between --start-lib and --end-lib normally and garbage collect unused sections, or</div><div> - create lazy symbols for object files between --start-lib and --end-lib and handle just like archive files.</div><div><br></div><div>What do you think?</div><div><br></div><div>*1 <a href="https://sourceware.org/ml/binutils/2010-03/msg00233.html" target="_blank">https://sourceware.org/ml/binutils/2010-03/msg00233.html</a></div></div>
</blockquote></div><br></div>