[PATCH] D47565: Fix /WholeArchive bug.

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 10:04:44 PDT 2018


rnk added inline comments.


================
Comment at: lld/COFF/Driver.cpp:1234
+  for (auto *Arg : Args.filtered(OPT_wholearchive_file))
+    WholeArchive.insert(Arg->getValue());
+
----------------
I think we need to canonicalize the path a little to ensure that this works on case insensitive file systems:
$ lld-link foo.lib -wholearchive:Foo.lib

We shouldn't enqueue the same file twice, right?

Also, maybe we should just enqueue all whole archive inputs in this loop, up front, and then only process inputs later if the input wasn't already added as a whole archive input.


================
Comment at: lld/COFF/Driver.cpp:1242
+    if (Optional<StringRef> Path = findFile(Arg->getValue()))
+      enqueuePath(*Path, Args.hasArg(OPT_wholearchive_flag) ||
+                             WholeArchive.count(Arg->getValue()));
----------------
I don't think `Args.hasArg(OPT_wholearchive_flag)` is the right check here, that asks if a whole archive flag appears anywhere on the command line, not if this particular flag is whole archive.


https://reviews.llvm.org/D47565





More information about the llvm-commits mailing list