summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/COFF/Driver.cpp4
-rw-r--r--lld/COFF/Options.td1
-rw-r--r--lld/MinGW/Driver.cpp2
-rw-r--r--lld/MinGW/Options.td3
-rw-r--r--lld/test/MinGW/driver.test7
5 files changed, 15 insertions, 2 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index f0400fbd16f..603dc666df4 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -801,7 +801,7 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
Config->Force = true;
// Handle /debug
- if (Args.hasArg(OPT_debug)) {
+ if (Args.hasArg(OPT_debug) || Args.hasArg(OPT_debug_dwarf)) {
Config->Debug = true;
if (auto *Arg = Args.getLastArg(OPT_debugtype))
Config->DebugTypes = parseDebugType(Arg->getValue());
@@ -1135,7 +1135,7 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
}
// Disable PDB generation if the user requested it.
- if (Args.hasArg(OPT_nopdb))
+ if (Args.hasArg(OPT_nopdb) || Args.hasArg(OPT_debug_dwarf))
Config->PDBPath = "";
// Set default image base if /base is not given.
diff --git a/lld/COFF/Options.td b/lld/COFF/Options.td
index 638516bc60e..1dcb3c857df 100644
--- a/lld/COFF/Options.td
+++ b/lld/COFF/Options.td
@@ -117,6 +117,7 @@ def help : F<"help">;
def help_q : Flag<["/?", "-?"], "">, Alias<help>;
// LLD extensions
+def debug_dwarf : F<"debug:dwarf">;
def export_all_symbols : F<"export-all-symbols">;
def nopdb : F<"nopdb">, HelpText<"Disable PDB generation for DWARF users">;
def nosymtab : F<"nosymtab">;
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index d71a17c9ebd..ecdf7d06571 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -152,6 +152,8 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
Add("-verbose");
if (Args.hasArg(OPT_export_all_symbols))
Add("-export-all-symbols");
+ if (!Args.hasArg(OPT_strip_all))
+ Add("-debug:dwarf");
if (auto *A = Args.getLastArg(OPT_m)) {
StringRef S = A->getValue();
diff --git a/lld/MinGW/Options.td b/lld/MinGW/Options.td
index 8c189b69ba4..595a08357f3 100644
--- a/lld/MinGW/Options.td
+++ b/lld/MinGW/Options.td
@@ -23,6 +23,8 @@ def output_def: S<"output-def">, HelpText<"Output def file">;
def shared: F<"shared">, HelpText<"Build a shared object">;
def subs: S<"subsystem">, HelpText<"Specify subsystem">;
def stack: S<"stack">;
+def strip_all: F<"strip-all">,
+ HelpText<"Omit all symbol information from the output binary">;
def whole_archive: F<"whole-archive">,
HelpText<"Include all object files for following archives">;
def verbose: F<"verbose">, HelpText<"Verbose mode">;
@@ -49,3 +51,4 @@ def version: F<"version">, HelpText<"Display the version number and exit">;
// Alias
def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>;
+def alias_strip_s: Flag<["-"], "s">, Alias<strip_all>;
diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test
index c85668f634a..c3c7005450a 100644
--- a/lld/test/MinGW/driver.test
+++ b/lld/test/MinGW/driver.test
@@ -82,3 +82,10 @@ OUTPUT-DEF: -output-def:out.def
RUN: ld.lld -### -m i386pep foo.o -Xlink=-lldmap | FileCheck -check-prefix XLINK %s
XLINK: -lldmap
+
+RUN: ld.lld -### -m i386pep foo.o | FileCheck -check-prefix DEBUG %s
+DEBUG: -debug:dwarf
+
+RUN: ld.lld -### -m i386pep foo.o -s | FileCheck -check-prefix STRIP %s
+RUN: ld.lld -### -m i386pep foo.o --strip-all | FileCheck -check-prefix STRIP %s
+STRIP-NOT: -debug:dwarf
OpenPOWER on IntegriCloud