aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2019-08-07 08:34:28 +0000
committerHans Wennborg <hans@hanshq.net>2019-08-07 08:34:28 +0000
commit825eb0fd2d8529d2e9d0689052690d52451865ff (patch)
tree3b686f7c458633901235267c31f07de11feeb89b
parentd55911285f09faa29430ab5b0ebf0de54b328118 (diff)
Merging r367837:
------------------------------------------------------------------------ r367837 | mstorsjo | 2019-08-05 13:57:06 +0200 (Mon, 05 Aug 2019) | 10 lines [MinGW] Add an lld specific option for requesting to delay load libraries With GNU tools, delayload is handled completely differently. (One creates a specific delayload import library using dlltool and then links against it instead of the normal import library.) Instead of requiring using -Xlink=-delayload:lib.dll, we can provide an lld specific option for this. Differential Revision: https://reviews.llvm.org/D65728 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/lld/branches/release_90@368134 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--MinGW/Driver.cpp2
-rw-r--r--MinGW/Options.td2
-rw-r--r--test/MinGW/driver.test4
3 files changed, 8 insertions, 0 deletions
diff --git a/MinGW/Driver.cpp b/MinGW/Driver.cpp
index 24e18aacb..be1b757e4 100644
--- a/MinGW/Driver.cpp
+++ b/MinGW/Driver.cpp
@@ -303,6 +303,8 @@ bool mingw::link(ArrayRef<const char *> argsArr, raw_ostream &diag) {
add("-include:" + StringRef(a->getValue()));
for (auto *a : args.filtered(OPT_undefined))
add("-includeoptional:" + StringRef(a->getValue()));
+ for (auto *a : args.filtered(OPT_delayload))
+ add("-delayload:" + StringRef(a->getValue()));
std::vector<StringRef> searchPaths;
for (auto *a : args.filtered(OPT_L)) {
diff --git a/MinGW/Options.td b/MinGW/Options.td
index 44de98dfc..86400433d 100644
--- a/MinGW/Options.td
+++ b/MinGW/Options.td
@@ -80,6 +80,8 @@ def require_defined_eq: J<"require-defined=">, Alias<require_defined>;
def _HASH_HASH_HASH : Flag<["-"], "###">,
HelpText<"Print (but do not run) the commands to run for this compilation">;
def appcontainer: F<"appcontainer">, HelpText<"Set the appcontainer flag in the executable">;
+def delayload: S<"delayload">, HelpText<"DLL to load only on demand">;
+def delayload_eq: J<"delayload=">, Alias<delayload>;
def mllvm: S<"mllvm">;
def pdb: S<"pdb">, HelpText<"Output PDB debug info file, chosen implicitly if the argument is empty">;
def pdb_eq: J<"pdb=">, Alias<pdb>;
diff --git a/test/MinGW/driver.test b/test/MinGW/driver.test
index cdd802e93..b8bc2ddea 100644
--- a/test/MinGW/driver.test
+++ b/test/MinGW/driver.test
@@ -200,3 +200,7 @@ APPCONTAINER: -appcontainer
# RUN: ld.lld -m i386pep --help 2>&1 | FileCheck -check-prefix=HELP %s
# HELP: USAGE:
# HELP: --enable-auto-import
+
+RUN: ld.lld -### -m i386pep foo.o -delayload user32.dll --delayload shell32.dll | FileCheck -check-prefix DELAYLOAD %s
+RUN: ld.lld -### -m i386pep foo.o -delayload=user32.dll --delayload=shell32.dll | FileCheck -check-prefix DELAYLOAD %s
+DELAYLOAD: -delayload:user32.dll -delayload:shell32.dll