[PATCH] D95727: llvm-shlib: Create object libraries for each component and link against them
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 1 22:49:44 PDT 2021
MaskRay added a comment.
In D95727#3101898 <https://reviews.llvm.org/D95727#3101898>, @tstellar wrote:
> In D95727#3076485 <https://reviews.llvm.org/D95727#3076485>, @MaskRay wrote:
>
>>> Is --start-lib something specific to lld? I did builds with binutils and libLLVM.so was the same size with and without this patch.
>>
>> gold and ld.lld support `--start-lib` for a long time. (Bazel uses `--start-lib` by default.)
>> GNU ld feature request: https://sourceware.org/bugzilla/show_bug.cgi?id=24600
>>
>> Switching away from archive semantics (http://maskray.me/blog/2021-06-20-symbol-processing) has the problem that unused `.debug_*` may be added to the output with gold and ld.lld.
>>
>> GNU ld may have a rarely known heuristic to not add `.debug_*` if all text section are garbage collected but I am not clear about its semantics.
>
> What do I need to do in order to avoid changing the output of lld and gold with this patch? Can I wrap the whole list of object files with -Wl,--start-lib and -Wl,--end-lib or do I need to have multiple --start-lib and --end-lib pairs, one for each original static archive?
One pair of `-Wl,--start-lib` and `-Wl,--end-lib` for each original archive.
If you have `-Wl,--start-lib a0.o a1.o -Wl,--end-lib -Wl,--start-lib b0.o b1.o -Wl,--end-lib`, `-Wl,--end-lib -Wl,--start-lib` can be cancelled.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95727/new/
https://reviews.llvm.org/D95727
More information about the llvm-commits
mailing list