[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 6 22:29:21 PDT 2020


MaskRay added a subscriber: psmith.
MaskRay added a comment.

In the thread "[llvm-dev] RFC: ELF Autolinking", @psmith said:

> I'm less convinced about --whole-archive as I think this tends to be a way of structuring the build and would be best made explicit in the build system. Moreover, what if someone wants to not use --whole-archive, for their autolink, but one already exists. This could be quite difficult to check with a large project. Personally I'd have the user be explicit in the .autolink whether they were intending it to be whole-archive or not.

@bd1976llvm replied:

> Right.. definitely possible to implement. So the trade offs are that it is possibly confusing if options like --whole-archive start applying to the "invisible" autolinked inputs. OTOH why not allow command line options to affect the autolinked inputs? It gives developers some more control at no cost (apart form the possible confusion).

>From the thread it seems that no conclusion on this point was made.



================
Comment at: lld/ELF/Driver.cpp:1423
+
+  // A sequence started with -whole-archive flag might not be closed with
+  // -no-whole-archive at the end of the command line because in normal usage
----------------
If we are going to do this

This comment can be greatly simplified. The first sentence can be removed.

You can just say: "dependent libraries are linked in --no-whole-archive mode". (Prefer the double dash form, which appears to be more common than the single dash form)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88877/new/

https://reviews.llvm.org/D88877



More information about the llvm-commits mailing list