[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 llvm-svn: 335947
This commit is contained in:
parent
3a7905b2aa
commit
c0826745cf
|
@ -149,6 +149,8 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
|
|||
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");
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ 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 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<"Display the version number and exit">;
|
|||
// 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>;
|
||||
|
|
|
@ -90,6 +90,11 @@ 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
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue