[MinGW] Add an option -Xlink for passing options through to lld-link
authorMartin Storsjo <martin@martin.st>
Fri, 3 Nov 2017 07:18:37 +0000 (07:18 +0000)
committerMartin Storsjo <martin@martin.st>
Fri, 3 Nov 2017 07:18:37 +0000 (07:18 +0000)
Also move the -mllvm option to the right section of the options
list.

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

llvm-svn: 317302

lld/MinGW/Driver.cpp
lld/MinGW/Options.td
lld/test/MinGW/driver.test

index 451ae2d..d71a17c 100644 (file)
@@ -170,6 +170,9 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
   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
index 1832ec5..8c189b6 100644 (file)
@@ -13,7 +13,6 @@ def export_all_symbols: F<"export-all-symbols">,
 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 @@ def verbose: F<"verbose">, HelpText<"Verbose mode">;
 // 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 : J<"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 b3303e1..c85668f 100644 (file)
@@ -79,3 +79,6 @@ EXPORT-ALL: -export-all-symbols
 
 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