diff options
author | Martin Storsjo <martin@martin.st> | 2017-09-13 07:28:09 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2017-09-13 07:28:09 +0000 |
commit | f59f3601f2c329b6be52c516de43282837300818 (patch) | |
tree | 1cc26b5b7d29f0958f21f19325dae442d326e269 /lld/MinGW | |
parent | a9a78d48893d594e2a23e563c2e38a02a9f623ed (diff) |
[MinGW] Add support for the options --[no-]whole-archive
Differential Revision: https://reviews.llvm.org/D37769
Diffstat (limited to 'lld/MinGW')
-rw-r--r-- | lld/MinGW/Driver.cpp | 23 | ||||
-rw-r--r-- | lld/MinGW/Options.td | 4 |
2 files changed, 22 insertions, 5 deletions
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp index 790bae792ed..e269ed8f755 100644 --- a/lld/MinGW/Driver.cpp +++ b/lld/MinGW/Driver.cpp @@ -172,11 +172,24 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) { for (auto *A : Args.filtered(OPT_L)) SearchPaths.push_back(A->getValue()); - for (auto *A : Args.filtered(OPT_INPUT, OPT_l)) { - if (A->getOption().getUnaliasedOption().getID() == OPT_INPUT) - Add(A->getValue()); - else - Add(searchLibrary(A->getValue(), SearchPaths, Args.hasArg(OPT_Bstatic))); + StringRef Prefix = ""; + for (auto *A : Args.filtered(OPT_INPUT, OPT_l, OPT_whole_archive, + OPT_no_whole_archive)) { + switch (A->getOption().getID()) { + case OPT_INPUT: + Add(Prefix + StringRef(A->getValue())); + break; + case OPT_l: + Add(Prefix + + searchLibrary(A->getValue(), SearchPaths, Args.hasArg(OPT_Bstatic))); + break; + case OPT_whole_archive: + Prefix = "-wholearchive:"; + break; + case OPT_no_whole_archive: + Prefix = ""; + break; + } } if (Args.hasArg(OPT_verbose)) diff --git a/lld/MinGW/Options.td b/lld/MinGW/Options.td index 74055770a68..53fb65661bb 100644 --- a/lld/MinGW/Options.td +++ b/lld/MinGW/Options.td @@ -12,12 +12,16 @@ def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">, HelpText<"Root name of library to use">; def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">; def mllvm: S<"mllvm">; +def no_whole_archive: F<"no-whole-archive">, + HelpText<"No longer include all object files for following archives">; def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">, HelpText<"Path to file to write output">; def out_implib: Separate<["--"], "out-implib">, HelpText<"Import library name">; def shared: F<"shared">, HelpText<"Build a shared object">; def subs: Separate<["--"], "subsystem">, HelpText<"Specify subsystem">; def stack: Separate<["--"], "stack">; +def whole_archive: F<"whole-archive">, + HelpText<"Include all object files for following archives">; def verbose: F<"verbose">, HelpText<"Verbose mode">; // LLD specific options |