diff options
author | Martin Storsjo <martin@martin.st> | 2019-06-08 18:26:24 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2019-06-08 18:26:24 +0000 |
commit | 7b7fe8b35499b3eeae80c8b435d4e8d363569b40 (patch) | |
tree | 679e546bd8c6f4e91d3ab196d497f3c99dd7b848 /MinGW | |
parent | 2ce9e95cd3b1d0c21fb947619918ac5c6ce1f868 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@362882 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'MinGW')
-rw-r--r-- | MinGW/Driver.cpp | 2 | ||||
-rw-r--r-- | MinGW/Options.td | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/MinGW/Driver.cpp b/MinGW/Driver.cpp index 36dde8d05..acab0d4a7 100644 --- a/MinGW/Driver.cpp +++ b/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/MinGW/Options.td b/MinGW/Options.td index 601492d83..242ae2552 100644 --- a/MinGW/Options.td +++ b/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">; |