Skip to content

Commit 0d17638

Browse files
committedSep 11, 2017
LLD: Add -mllvm flag to the MinGW driver.
This adds support for passing LTO flags to the MINGW driver in GNU LD style i.e. -mllvm flag -> /mllvm:flag Reviewers: ruiu, mstorsjo Differential Revision: https://reviews.llvm.org/D37712 llvm-svn: 312956
1 parent 71bc1af commit 0d17638

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
 

‎lld/MinGW/Driver.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ bool link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
160160
error("unknown parameter: -m" + S);
161161
}
162162

163+
for (auto *A : Args.filtered(OPT_mllvm))
164+
Add("-mllvm:" + StringRef(A->getValue()));
165+
163166
if (Args.getLastArgValue(OPT_m) == "i386pe")
164167
Add("-alternatename:__image_base__=___ImageBase");
165168
else

‎lld/MinGW/Options.td

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def entry: S<"entry">, MetaVarName<"<entry>">,
1111
def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
1212
HelpText<"Root name of library to use">;
1313
def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
14+
def mllvm: S<"mllvm">;
1415
def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
1516
HelpText<"Path to file to write output">;
1617
def out_implib: Separate<["--"], "out-implib">, HelpText<"Import library name">;
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; REQUIRES: x86
2+
; RUN: llvm-as %s -o %t.obj
3+
; RUN: ld.lld -m i386pep -shared -o %t.dll %t.obj -mllvm -debug-pass=Arguments 2>&1 | FileCheck %s
4+
5+
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
6+
target triple = "x86_64-pc-windows-gnu"
7+
8+
define void @dummy() {
9+
ret void
10+
}
11+
12+
define void @_DllMainCRTStartup() {
13+
ret void
14+
}
15+
16+
; CHECK: Pass Arguments:

0 commit comments

Comments
 (0)
Please sign in to comment.