[PATCH] D37794: [LLD] [MinGW] Only apply -Bstatic to following libraries
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 13 12:31:25 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL313175: [MinGW] Only apply -Bstatic to following libraries (authored by mstorsjo).
Changed prior to commit:
https://reviews.llvm.org/D37794?vs=114989&id=115098#toc
Repository:
rL LLVM
https://reviews.llvm.org/D37794
Files:
lld/trunk/MinGW/Driver.cpp
lld/trunk/test/MinGW/lib.test
Index: lld/trunk/MinGW/Driver.cpp
===================================================================
--- lld/trunk/MinGW/Driver.cpp
+++ lld/trunk/MinGW/Driver.cpp
@@ -174,25 +174,30 @@
SearchPaths.push_back(A->getValue());
StringRef Prefix = "";
- for (auto *A : Args.filtered(OPT_INPUT, OPT_l, OPT_whole_archive,
- OPT_no_whole_archive)) {
+ bool Static = false;
+ for (auto *A : Args) {
switch (A->getOption().getID()) {
case OPT_INPUT:
if (StringRef(A->getValue()).endswith(".def"))
Add("-def:" + StringRef(A->getValue()));
else
Add(Prefix + StringRef(A->getValue()));
break;
case OPT_l:
- Add(Prefix +
- searchLibrary(A->getValue(), SearchPaths, Args.hasArg(OPT_Bstatic)));
+ Add(Prefix + searchLibrary(A->getValue(), SearchPaths, Static));
break;
case OPT_whole_archive:
Prefix = "-wholearchive:";
break;
case OPT_no_whole_archive:
Prefix = "";
break;
+ case OPT_Bstatic:
+ Static = true;
+ break;
+ case OPT_Bdynamic:
+ Static = false;
+ break;
}
}
Index: lld/trunk/test/MinGW/lib.test
===================================================================
--- lld/trunk/test/MinGW/lib.test
+++ lld/trunk/test/MinGW/lib.test
@@ -7,9 +7,15 @@
RUN: ld.lld -### -m i386pep -lfoo -L%t/lib | FileCheck -check-prefix=LIB2 %s
LIB2: libfoo.dll.a
-RUN: not ld.lld -### -m i386pep -lfoo -L%t/lib -Bstatic 2>&1 | FileCheck -check-prefix=LIB3 %s
+RUN: not ld.lld -### -m i386pep -Bstatic -lfoo -L%t/lib 2>&1 | FileCheck -check-prefix=LIB3 %s
LIB3: unable to find library -lfoo
RUN: echo > %t/lib/libfoo.a
-RUN: ld.lld -### -m i386pep -lfoo -L%t/lib -Bstatic | FileCheck -check-prefix=LIB4 %s
+RUN: ld.lld -### -m i386pep -Bstatic -lfoo -L%t/lib | FileCheck -check-prefix=LIB4 %s
LIB4: libfoo.a
+
+RUN: echo > %t/lib/libbar.dll.a
+RUN: echo > %t/lib/libbar.a
+RUN: ld.lld -### -m i386pep -Bstatic -lfoo -Bdynamic -lbar -L%t/lib | FileCheck -check-prefix=LIB5 %s
+LIB5: libfoo.a
+LIB5-SAME: libbar.dll.a
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37794.115098.patch
Type: text/x-patch
Size: 2105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170913/2964fc58/attachment.bin>
More information about the llvm-commits
mailing list