summaryrefslogtreecommitdiffstats
path: root/lld/MinGW
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-06-08 18:26:24 +0000
committerMartin Storsjo <martin@martin.st>2019-06-08 18:26:24 +0000
commit4962f9464da844557732913805befb194b0e0c7a (patch)
treeec5d589d435a6c200b43309db0f0c50f24a06607 /lld/MinGW
parentc02f6bf07f6ba5b67f716f74f7abe0bab157d920 (diff)
downloadbcm5719-llvm-4962f9464da844557732913805befb194b0e0c7a.tar.gz
bcm5719-llvm-4962f9464da844557732913805befb194b0e0c7a.zip
[MinGW] Support the -u/--undefined option.
This is implemented by the lld-link option -include:, just like --require-defined. Contrary to --require-defined, the -u/--undefined option allows the symbol to remain undefined in the end. This should fix PR42121. Differential Revision: https://reviews.llvm.org/D62876 llvm-svn: 362882
Diffstat (limited to 'lld/MinGW')
-rw-r--r--lld/MinGW/Driver.cpp2
-rw-r--r--lld/MinGW/Options.td4
2 files changed, 6 insertions, 0 deletions
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 36dde8d052c..acab0d4a76c 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -269,6 +269,8 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
for (auto *A : Args.filtered(OPT_require_defined))
Add("-include:" + StringRef(A->getValue()));
+ for (auto *A : Args.filtered(OPT_undefined))
+ Add("-includeoptional:" + 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 601492d8316..242ae255249 100644
--- a/lld/MinGW/Options.td
+++ b/lld/MinGW/Options.td
@@ -46,6 +46,10 @@ def strip_all: F<"strip-all">,
HelpText<"Omit all symbol information from the output binary">;
def strip_debug: F<"strip-debug">,
HelpText<"Omit all debug information, but keep symbol information">;
+def undefined: S<"u">,
+ HelpText<"Include symbol in the link, if available">;
+def undefined_long: S<"undefined">, Alias<undefined>;
+def undefined_eq: J<"undefined=">, Alias<undefined>;
def whole_archive: F<"whole-archive">,
HelpText<"Include all object files for following archives">;
def v: Flag<["-"], "v">, HelpText<"Display the version number">;
OpenPOWER on IntegriCloud