[lld] r334761 - [COFF] Fix /wholearchive: to do libpath search again

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 14 12:56:04 PDT 2018


Author: rnk
Date: Thu Jun 14 12:56:03 2018
New Revision: 334761

URL: http://llvm.org/viewvc/llvm-project?rev=334761&view=rev
Log:
[COFF] Fix /wholearchive: to do libpath search again

Fixes https://crbug.com/852882

Modified:
    lld/trunk/COFF/Driver.cpp
    lld/trunk/test/COFF/wholearchive.s

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=334761&r1=334760&r2=334761&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Thu Jun 14 12:56:03 2018
@@ -1247,8 +1247,9 @@ void LinkerDriver::link(ArrayRef<const c
 
   std::set<sys::fs::UniqueID> WholeArchives;
   for (auto *Arg : Args.filtered(OPT_wholearchive_file))
-    if (Optional<sys::fs::UniqueID> ID = getUniqueID(Arg->getValue()))
-      WholeArchives.insert(*ID);
+    if (Optional<StringRef> Path = doFindFile(Arg->getValue()))
+      if (Optional<sys::fs::UniqueID> ID = getUniqueID(*Path))
+        WholeArchives.insert(*ID);
 
   // A predicate returning true if a given path is an argument for
   // /wholearchive:, or /wholearchive is enabled globally.
@@ -1266,7 +1267,7 @@ void LinkerDriver::link(ArrayRef<const c
   // for /defaultlib option.
   for (auto *Arg : Args.filtered(OPT_INPUT, OPT_wholearchive_file))
     if (Optional<StringRef> Path = findFile(Arg->getValue()))
-      enqueuePath(*Path, IsWholeArchive(Arg->getValue()));
+      enqueuePath(*Path, IsWholeArchive(*Path));
 
   for (auto *Arg : Args.filtered(OPT_defaultlib))
     if (Optional<StringRef> Path = findLib(Arg->getValue()))

Modified: lld/trunk/test/COFF/wholearchive.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/wholearchive.s?rev=334761&r1=334760&r2=334761&view=diff
==============================================================================
--- lld/trunk/test/COFF/wholearchive.s (original)
+++ lld/trunk/test/COFF/wholearchive.s Thu Jun 14 12:56:03 2018
@@ -15,7 +15,7 @@
 
 # RUN: mkdir -p %t.dir
 # RUN: cp %t.archive.lib %t.dir/foo.lib
-# RUN: lld-link -dll -out:%t.dll -entry:main %t.main.obj %t.dir/./foo.lib -wholearchive:%t.dir/foo.lib -implib:%t.lib
+# RUN: lld-link -dll -out:%t.dll -entry:main -libpath:%t.dir %t.main.obj %t.dir/./foo.lib -wholearchive:foo.lib -implib:%t.lib
 # RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB
 
 # CHECK-IMPLIB: Symbol: __imp_exportfn3




More information about the llvm-commits mailing list