summaryrefslogtreecommitdiffstats
path: root/lld/MinGW
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-05-17 11:07:38 +0000
committerMartin Storsjo <martin@martin.st>2019-05-17 11:07:38 +0000
commit9ae0d222dc8f982b7e1b856edd8d6a53d967933d (patch)
tree984a964522cd681c25d6a536c61bef810c2c9265 /lld/MinGW
parent2c52ddf31f5421c5373923535b958b84c79772e3 (diff)
downloadbcm5719-llvm-9ae0d222dc8f982b7e1b856edd8d6a53d967933d.tar.gz
bcm5719-llvm-9ae0d222dc8f982b7e1b856edd8d6a53d967933d.zip
[MinGW] Implement --help for the MinGW driver
Differential Revision: https://reviews.llvm.org/D62029 llvm-svn: 361015
Diffstat (limited to 'lld/MinGW')
-rw-r--r--lld/MinGW/Driver.cpp17
-rw-r--r--lld/MinGW/Options.td1
2 files changed, 16 insertions, 2 deletions
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 9ef85141771..28ce49d6e1b 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -78,6 +78,13 @@ public:
};
} // namespace
+static void printHelp(const char *Argv0) {
+ MinGWOptTable().PrintHelp(
+ outs(), (std::string(Argv0) + " [options] file...").c_str(), "lld",
+ false /*ShowHidden*/, true /*ShowAllAliases*/);
+ outs() << "\n";
+}
+
opt::InputArgList MinGWOptTable::parse(ArrayRef<const char *> Argv) {
unsigned MissingIndex;
unsigned MissingCount;
@@ -89,8 +96,6 @@ opt::InputArgList MinGWOptTable::parse(ArrayRef<const char *> Argv) {
fatal(StringRef(Args.getArgString(MissingIndex)) + ": missing argument");
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
fatal("unknown argument: " + Arg->getSpelling());
- if (!Args.hasArg(OPT_INPUT) && !Args.hasArg(OPT_l))
- fatal("no input files");
return Args;
}
@@ -129,6 +134,14 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
MinGWOptTable Parser;
opt::InputArgList Args = Parser.parse(ArgsArr.slice(1));
+ if (Args.hasArg(OPT_help)) {
+ printHelp(ArgsArr[0]);
+ return true;
+ }
+
+ if (!Args.hasArg(OPT_INPUT) && !Args.hasArg(OPT_l))
+ fatal("no input files");
+
std::vector<std::string> LinkArgs;
auto Add = [&](const Twine &S) { LinkArgs.push_back(S.str()); };
diff --git a/lld/MinGW/Options.td b/lld/MinGW/Options.td
index 2cfce15abae..b6e6b09c754 100644
--- a/lld/MinGW/Options.td
+++ b/lld/MinGW/Options.td
@@ -16,6 +16,7 @@ def exclude_all_symbols: F<"exclude-all-symbols">,
def export_all_symbols: F<"export-all-symbols">,
HelpText<"Export all symbols even if a def file or dllexport attributes are used">;
def gc_sections: F<"gc-sections">, HelpText<"Remove unused sections">;
+def help: F<"help">, HelpText<"Print option help">;
def icf: J<"icf=">, HelpText<"Identical code folding">;
def image_base: S<"image-base">, HelpText<"Base address of the program">;
def insert_timestamp: F<"insert-timestamp">,
OpenPOWER on IntegriCloud