aboutsummaryrefslogtreecommitdiff
path: root/lld
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-08-05 11:57:06 +0000
committerMartin Storsjo <martin@martin.st>2019-08-05 11:57:06 +0000
commitc92b3563c63547984516cbb1223d3cbfc8336fee (patch)
tree247a8037c0c9f0a458ad7c6fa04b50dc6408db99 /lld
parenta0cbe16ed5197c2f882e44b0c758576ae409124b (diff)
downloadllvm-c92b3563c63547984516cbb1223d3cbfc8336fee.zip
llvm-c92b3563c63547984516cbb1223d3cbfc8336fee.tar.gz
llvm-c92b3563c63547984516cbb1223d3cbfc8336fee.tar.bz2
[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 llvm-svn: 367837
Diffstat (limited to 'lld')
-rw-r--r--lld/MinGW/Driver.cpp2
-rw-r--r--lld/MinGW/Options.td2
-rw-r--r--lld/test/MinGW/driver.test4
3 files changed, 8 insertions, 0 deletions
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 24e18aa..be1b757 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/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/lld/MinGW/Options.td b/lld/MinGW/Options.td
index 44de98d..8640043 100644
--- a/lld/MinGW/Options.td
+++ b/lld/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/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test
index cdd802e..b8bc2dd 100644
--- a/lld/test/MinGW/driver.test
+++ b/lld/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