-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for "object libraries" -- a "--start-lib"/"--end-lib" like mode in lld-macho #52931
Comments
Does ld64 have equivalent functionality, or would it be an extension? It's fine either way; I was just wondering where the |
I don't think it does. This is one of our internal LD64 optimisations, which I'd like preserve. |
I prefer start/end because it conveys more information and matches ld.lld/lld-link. In ld.lld, For Note that this feature should be carefully implemented so that it is possible to use this lazy object file to model Actually I have some interest to implement this, as I did some work for ELF and PE/COFF, even just to find a random contribution I can make :) |
Re: start/end Feel free to take it! 👏 thanks! |
In ld.lld, when an ObjFile/BitcodeFile is read in --start-lib state, the file is given archive semantics. --end-lib closes the previous --start-lib. A build system can use this feature as an alternative to archives. This patch ports the feature to lld-macho. --start-lib and --end-lib are positional, unlike usual ld64 options. I think the slight drawback does not matter as (a) reusing option names make build systems convenient (b) `--start-lib a.o b.o --end-lib` conveys more information than an alternative design: `-objlib a.o -objlib b.o` because --start-lib makes it clear which objects are in the same conceptual archive. This provides flexibility (c) `-objlib`/`-filelist` interaction may be weird. Close llvm/llvm-project#52931 Reviewed By: #lld-macho, Jez Ng, oontvoo Differential Revision: https://reviews.llvm.org/D116913
This allows it to accept "-objlib foo.o", which lazily includes foo.o into the link, as if it was in an archive file.
Edit: (Optional)
Also support spelling of "//-objlib". This allows it to be passed through older versions of Clang properly, when spelled as "-Wl,//-objlist". Older Clang versions will invoke the linker with "-filelist", which can only pass "filenames", not options, so we pretend to be a filename.
The text was updated successfully, but these errors were encountered: