[PATCH] D102637: [lld][MinGW] Introduce aliases for -Bdynamic and -Bstatic

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 10:08:16 PDT 2021


zero9178 created this revision.
zero9178 added reviewers: mstorsjo, rnk.
Herald added subscribers: jeroen.dobbelaere, dang.
zero9178 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Besides -Bdynamic and -Bstatic, ld documents additional aliases for both of these options. Instead of -Bstatic, one may write -dn, -non_shared or -static. Instead of -Bdynamic one may write -dy or -call_shared. Source: https://sourceware.org/binutils/docs-2.36/ld/Options.html

This patch adds those aliases to the MinGW driver of lld for the sake of ld compatibility.

Encountered this case while compiling a static Qt 6.1 distribution and got build failures as -static was passed directly to the linker, instead of through the compiler driver.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102637

Files:
  lld/MinGW/Options.td
  lld/test/MinGW/lib.test


Index: lld/test/MinGW/lib.test
===================================================================
--- lld/test/MinGW/lib.test
+++ lld/test/MinGW/lib.test
@@ -15,6 +15,9 @@
 LIB-LITERAL: barefilename
 
 RUN: not ld.lld -### -m i386pep -Bstatic -lfoo -L%t/lib 2>&1 | FileCheck -check-prefix=LIB3 %s
+RUN: not ld.lld -### -m i386pep -dn -lfoo -L%t/lib 2>&1 | FileCheck -check-prefix=LIB3 %s
+RUN: not ld.lld -### -m i386pep -static -lfoo -L%t/lib 2>&1 | FileCheck -check-prefix=LIB3 %s
+RUN: not ld.lld -### -m i386pep -non_shared -lfoo -L%t/lib 2>&1 | FileCheck -check-prefix=LIB3 %s
 LIB3: unable to find library -lfoo
 
 RUN: echo > %t/lib/libfoo.a
@@ -24,6 +27,8 @@
 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
+RUN: ld.lld -### -m i386pep -Bstatic -lfoo -dy -lbar -L%t/lib | FileCheck -check-prefix=LIB5 %s
+RUN: ld.lld -### -m i386pep -Bstatic -lfoo -call_shared -lbar -L%t/lib | FileCheck -check-prefix=LIB5 %s
 LIB5:      libfoo.a
 LIB5-SAME: libbar.dll.a
 
Index: lld/MinGW/Options.td
===================================================================
--- lld/MinGW/Options.td
+++ lld/MinGW/Options.td
@@ -114,6 +114,11 @@
 def alias_strip_s: Flag<["-"], "s">, Alias<strip_all>;
 def alias_strip_S: Flag<["-"], "S">, Alias<strip_debug>;
 def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
+def alias_Bdynamic_dy: Flag<["-"],"dy">,Alias<Bdynamic>;
+def alias_Bdynamic_call_shared: Flag<["-"],"call_shared">,Alias<Bdynamic>;
+def alias_Bstatic_dn: Flag<["-"],"dn">,Alias<Bstatic>;
+def alias_Bstatic_static: Flag<["-"],"static">,Alias<Bstatic>;
+def alias_Bstatic_non_shared: Flag<["-"],"non_shared">,Alias<Bstatic>;
 
 // Ignored options
 def: Joined<["-"], "O">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102637.345913.patch
Type: text/x-patch
Size: 1811 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210517/95ae4463/attachment.bin>


More information about the llvm-commits mailing list