[PATCH] D39528: [LLD] [MinGW] Add an option -Xlink for passing options through to lld-link

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 14:09:09 PDT 2017


mstorsjo updated this revision to Diff 121373.
mstorsjo added a comment.

Using the form `-Xlink=-foo` as requested.


https://reviews.llvm.org/D39528

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


Index: test/MinGW/driver.test
===================================================================
--- test/MinGW/driver.test
+++ test/MinGW/driver.test
@@ -79,3 +79,6 @@
 
 RUN: ld.lld -### -m i386pep foo.o --output-def out.def | FileCheck -check-prefix OUTPUT-DEF %s
 OUTPUT-DEF: -output-def:out.def
+
+RUN: ld.lld -### -m i386pep foo.o -Xlink=-lldmap | FileCheck -check-prefix XLINK %s
+XLINK: -lldmap
Index: MinGW/Options.td
===================================================================
--- MinGW/Options.td
+++ MinGW/Options.td
@@ -13,7 +13,6 @@
 def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
   HelpText<"Root name of library to use">;
 def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
-def mllvm: S<"mllvm">;
 def no_whole_archive: F<"no-whole-archive">,
     HelpText<"No longer include all object files for following archives">;
 def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
@@ -31,6 +30,9 @@
 // LLD specific options
 def _HASH_HASH_HASH : Flag<["-"], "###">,
     HelpText<"Print (but do not run) the commands to run for this compilation">;
+def mllvm: S<"mllvm">;
+def Xlink : Joined<["-"], "Xlink=">, MetaVarName<"<arg>">,
+    HelpText<"Pass <arg> to the COFF linker">;
 
 // Currently stubs to avoid errors
 def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;
Index: MinGW/Driver.cpp
===================================================================
--- MinGW/Driver.cpp
+++ MinGW/Driver.cpp
@@ -170,6 +170,9 @@
   for (auto *A : Args.filtered(OPT_mllvm))
     Add("-mllvm:" + StringRef(A->getValue()));
 
+  for (auto *A : Args.filtered(OPT_Xlink))
+    Add(A->getValue());
+
   if (Args.getLastArgValue(OPT_m) == "i386pe")
     Add("-alternatename:__image_base__=___ImageBase");
   else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39528.121373.patch
Type: text/x-patch
Size: 1785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171102/3a5d77f4/attachment.bin>


More information about the llvm-commits mailing list