[PATCH] D88877: [ELF] Drop --whole-archive before processing dependent libraries.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 15:08:20 PDT 2020
MaskRay added a comment.
In D88877#2342920 <https://reviews.llvm.org/D88877#2342920>, @bd1976llvm wrote:
> In D88877#2334222 <https://reviews.llvm.org/D88877#2334222>, @ikudrin wrote:
>
>> Hmm, that starts looking like a discussion for the mailing list, but I guess that all interested people are already here and the conversation will be better preserved for further references if being linked to the review.
>>
>> In D88877#2332692 <https://reviews.llvm.org/D88877#2332692>, @bd1976llvm wrote:
>>
>>>> Unfortunately, sometimes that is not that simple as it sounds. In our case, the users who need autolinking are different from a unit that provides tools to adjust command lines. There is no option to add anything at the very end.
>>>
>>> Thanks for supplying this detail. To me this sounds like you need to file a bug against the tools unit? I want to evaluate your proposal on it's own merits rather accepting it to work around problems caused by other tools.
>>
>> And for the tool unit folks that looks like an issue in the linker. Why should they work around problems caused by the linker? Why not fix them in the source? After all, build systems are many and reasoning for fixing them is vague. Closing "--whole-archive" range is more like tidiness, which was not that strictly required before (or without) the autolinking feature.
>
> I think I agree that build systems might not easily be able to arrange for appending options to the end of the linker command line. Therefore, for the "dependent libraries" feature (I changed the name in https://reviews.llvm.org/D60274 because autolinking was too general) it would be reasonable to reset any temporal options that the build system would otherwise have to handle by appending an argument to the very end of the command line (e.g. --whole-archives). Where appropriate we can create new order-independent options to apply the options that are reset to the dependent libraries. This seems like an improvement over what we have now.
Regarding resetting any temporal options, I think users may not want to reset --as-needed to --no-as-needed. Unclosed --as-needed may be used: --as-needed generally works with system libraries added by GCC/clang drivers.
Regarding the build system, --whole-archive --no-whole-archive pairs are usually used together and localized. I'd still want to understand why there may be an unclosed --whole-archive.
If there is an unclosed --whole-archive, with -static-libgcc, libgcc.a and libgcc_eh.a will be linked in --whole-archive mode. Usually there will be multiple definition issues in libgcc.a.
Similarly, with -static-libstdc++, libstdc++/libc++ will be linked in --whole-archive mode.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88877/new/
https://reviews.llvm.org/D88877
More information about the llvm-commits
mailing list