[PATCH] D53015: [LLD] [MinGW] Pass libpath to the COFF linker

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 01:23:51 PDT 2018


mstorsjo created this revision.
mstorsjo added reviewers: rnk, smeenai, ruiu.

This is necessary for handling defaultlib directives embedded in object files, unless they use an absolute path.

This is needed in all incarnations of https://reviews.llvm.org/D53012 and regardless of whether https://reviews.llvm.org/D53013 is picked or not.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53015

Files:
  MinGW/Driver.cpp
  test/MinGW/driver.test


Index: test/MinGW/driver.test
===================================================================
--- test/MinGW/driver.test
+++ test/MinGW/driver.test
@@ -148,3 +148,6 @@
 
 RUN: ld.lld -### foo.o -m i386pe -require-defined _foo --require-defined _bar -require-defined=_baz --require-defined=_foo2 | FileCheck -check-prefix=REQUIRE-DEFINED %s
 REQUIRE-DEFINED: -include:_foo -include:_bar -include:_baz -include:_foo2
+
+RUN: ld.lld -### -m i386pep foo.o -Llibpath | FileCheck -check-prefix LIBPATH %s
+LIBPATH: -libpath:libpath
Index: MinGW/Driver.cpp
===================================================================
--- MinGW/Driver.cpp
+++ MinGW/Driver.cpp
@@ -216,8 +216,10 @@
     Add("-include:" + StringRef(A->getValue()));
 
   std::vector<StringRef> SearchPaths;
-  for (auto *A : Args.filtered(OPT_L))
+  for (auto *A : Args.filtered(OPT_L)) {
     SearchPaths.push_back(A->getValue());
+    Add("-libpath:" + StringRef(A->getValue()));
+  }
 
   StringRef Prefix = "";
   bool Static = false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53015.168756.patch
Type: text/x-patch
Size: 1008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181009/768c28c6/attachment.bin>


More information about the llvm-commits mailing list