[PATCH] D37709: [MinGW] Add support for the options --[no-]whole-archive

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 23:40:59 PDT 2017


pcc added inline comments.


================
Comment at: COFF/Options.td:99-100
 
+def whole_archive : F<"whole-archive">;
+def no_whole_archive : F<"no-whole-archive">;
+
----------------
mstorsjo wrote:
> pcc wrote:
> > ruiu wrote:
> > > Since they are lld-specific flags, I'd name -lld-whole-archive and -lld-no-whole-archive.
> > I don't think you need to add lld-specific flags to support `--whole-archive`. Instead, you could implement support for the equivalent link.exe flag, `/wholearchive`. See also PR31824.
> @pcc - Oh, that probably makes sense - I hadn't seen that option before. Then the MinGW driver just needs to inject `-wholearchive:` before each library between `--whole-archive` and `--no-whole-archive`. Since the driver doesn't do file magic detection, it probably needs to only match this for `*.a`, `*.lib` and `-lfoo` entries, but that's probably fine for most sensible use cases.
Right. I think you wouldn't even need to do the matching; MSVC link.exe allows `/wholearchive` to be used with object files, and we can do the same.


https://reviews.llvm.org/D37709





More information about the llvm-commits mailing list