[lld] r335947 - [MinGW] Implement the GNU ld options -S/--strip-debug
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 28 23:08:31 PDT 2018
Author: mstorsjo
Date: Thu Jun 28 23:08:31 2018
New Revision: 335947
URL: http://llvm.org/viewvc/llvm-project?rev=335947&view=rev
Log:
[MinGW] Implement the GNU ld options -S/--strip-debug
In this mode, we retain the symbol table, but skip the actual debug
information.
Differential Revision: https://reviews.llvm.org/D48745
Modified:
lld/trunk/MinGW/Driver.cpp
lld/trunk/MinGW/Options.td
lld/trunk/test/MinGW/driver.test
Modified: lld/trunk/MinGW/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/MinGW/Driver.cpp?rev=335947&r1=335946&r2=335947&view=diff
==============================================================================
--- lld/trunk/MinGW/Driver.cpp (original)
+++ lld/trunk/MinGW/Driver.cpp Thu Jun 28 23:08:31 2018
@@ -149,6 +149,8 @@ bool mingw::link(ArrayRef<const char *>
if (auto *A = Args.getLastArg(OPT_pdb)) {
Add("-debug");
Add("-pdb:" + StringRef(A->getValue()));
+ } else if (Args.hasArg(OPT_strip_debug)) {
+ Add("-debug:symtab");
} else if (!Args.hasArg(OPT_strip_all)) {
Add("-debug:dwarf");
}
Modified: lld/trunk/MinGW/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/MinGW/Options.td?rev=335947&r1=335946&r2=335947&view=diff
==============================================================================
--- lld/trunk/MinGW/Options.td (original)
+++ lld/trunk/MinGW/Options.td Thu Jun 28 23:08:31 2018
@@ -35,6 +35,8 @@ def subs: S<"subsystem">, HelpText<"Spec
def stack: S<"stack">;
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 whole_archive: F<"whole-archive">,
HelpText<"Include all object files for following archives">;
def verbose: F<"verbose">, HelpText<"Verbose mode">;
@@ -72,3 +74,4 @@ def version: F<"version">, HelpText<"Dis
// Alias
def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>;
def alias_strip_s: Flag<["-"], "s">, Alias<strip_all>;
+def alias_strip_S: Flag<["-"], "S">, Alias<strip_debug>;
Modified: lld/trunk/test/MinGW/driver.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/MinGW/driver.test?rev=335947&r1=335946&r2=335947&view=diff
==============================================================================
--- lld/trunk/test/MinGW/driver.test (original)
+++ lld/trunk/test/MinGW/driver.test Thu Jun 28 23:08:31 2018
@@ -90,6 +90,11 @@ RUN: ld.lld -### -m i386pep foo.o -s | F
RUN: ld.lld -### -m i386pep foo.o --strip-all | FileCheck -check-prefix STRIP %s
STRIP-NOT: -debug:dwarf
+RUN: ld.lld -### -m i386pep foo.o -S | FileCheck -check-prefix STRIP-DEBUG %s
+RUN: ld.lld -### -m i386pep foo.o --strip-debug | FileCheck -check-prefix STRIP-DEBUG %s
+STRIP-DEBUG: -debug:symtab
+STRIP-DEBUG-NOT: -debug:dwarf
+
RUN: ld.lld -### -m i386pep foo.o -pdb out.pdb | FileCheck -check-prefix PDB %s
PDB: -debug -pdb:out.pdb
PDB-NOT: -debug:dwarf
More information about the llvm-commits
mailing list