Skip to content

Commit

Permalink
[MinGW] Pass libpath to the COFF linker
Browse files Browse the repository at this point in the history
This is necessary for handling defaultlib directives embedded in
object files, unless they use an absolute path.

Differential Revision: https://reviews.llvm.org/D53015

llvm-svn: 344123
  • Loading branch information
mstorsjo committed Oct 10, 2018
1 parent 60b6f14 commit 803b37a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lld/MinGW/Driver.cpp
Expand Up @@ -216,8 +216,10 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
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;
Expand Down
3 changes: 3 additions & 0 deletions lld/test/MinGW/driver.test
Expand Up @@ -148,3 +148,6 @@ MAP: -lldmap:bar.map

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

0 comments on commit 803b37a

Please sign in to comment.