[lld] r335946 - [COFF] Add an LLD specific option -debug:symbtab
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 28 23:08:26 PDT 2018
Author: mstorsjo
Date: Thu Jun 28 23:08:25 2018
New Revision: 335946
URL: http://llvm.org/viewvc/llvm-project?rev=335946&view=rev
Log:
[COFF] Add an LLD specific option -debug:symbtab
With this set, we retain the symbol table, but skip the actual debug
information.
This is meant to be used by the MinGW frontend.
Differential Revision: https://reviews.llvm.org/D48745
Modified:
lld/trunk/COFF/Config.h
lld/trunk/COFF/Driver.cpp
lld/trunk/COFF/Options.td
lld/trunk/COFF/Writer.cpp
lld/trunk/test/COFF/sort-debug.test
lld/trunk/test/COFF/symtab.test
Modified: lld/trunk/COFF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Config.h?rev=335946&r1=335945&r2=335946&view=diff
==============================================================================
--- lld/trunk/COFF/Config.h (original)
+++ lld/trunk/COFF/Config.h Thu Jun 28 23:08:25 2018
@@ -98,6 +98,7 @@ struct Configuration {
bool Debug = false;
bool DebugDwarf = false;
bool DebugGHashes = false;
+ bool DebugSymtab = false;
bool ShowTiming = false;
unsigned DebugTypes = static_cast<unsigned>(DebugType::None);
std::vector<std::string> NatvisFiles;
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=335946&r1=335945&r2=335946&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Thu Jun 28 23:08:25 2018
@@ -1217,6 +1217,7 @@ void LinkerDriver::link(ArrayRef<const c
!Config->DLL && Args.hasFlag(OPT_tsaware, OPT_tsaware_no, true);
Config->DebugDwarf = Args.hasArg(OPT_debug_dwarf);
Config->DebugGHashes = Args.hasArg(OPT_debug_ghash);
+ Config->DebugSymtab = Args.hasArg(OPT_debug_symtab);
Config->MapFile = getMapFile(Args);
Modified: lld/trunk/COFF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Options.td?rev=335946&r1=335945&r2=335946&view=diff
==============================================================================
--- lld/trunk/COFF/Options.td (original)
+++ lld/trunk/COFF/Options.td Thu Jun 28 23:08:25 2018
@@ -139,6 +139,7 @@ def help_q : Flag<["/?", "-?"], "">, Ali
// LLD extensions
def debug_ghash : F<"debug:ghash">;
def debug_dwarf : F<"debug:dwarf">;
+def debug_symtab : F<"debug:symtab">;
def export_all_symbols : F<"export-all-symbols">;
def kill_at : F<"kill-at">;
def lldmingw : F<"lldmingw">;
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=335946&r1=335945&r2=335946&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Thu Jun 28 23:08:25 2018
@@ -665,7 +665,7 @@ void Writer::createSymbolAndStringTable(
Sec->setStringTableOff(addEntryToStringTable(Sec->Name));
}
- if (Config->DebugDwarf) {
+ if (Config->DebugDwarf || Config->DebugSymtab) {
for (ObjFile *File : ObjFile::Instances) {
for (Symbol *B : File->getSymbols()) {
auto *D = dyn_cast_or_null<Defined>(B);
Modified: lld/trunk/test/COFF/sort-debug.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/sort-debug.test?rev=335946&r1=335945&r2=335946&view=diff
==============================================================================
--- lld/trunk/test/COFF/sort-debug.test (original)
+++ lld/trunk/test/COFF/sort-debug.test Thu Jun 28 23:08:25 2018
@@ -1,6 +1,12 @@
# RUN: yaml2obj < %s > %t.obj
# RUN: lld-link /debug /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -sections %t.exe | FileCheck %s
+# RUN: lld-link /debug:dwarf /out:%t.exe /entry:main %t.obj
+# RUN: llvm-readobj -sections %t.exe | FileCheck %s
+# RUN: lld-link /out:%t.exe /entry:main %t.obj
+# RUN: llvm-readobj -sections %t.exe | FileCheck -check-prefix=NODEBUG %s
+# RUN: lld-link /debug:symtab /out:%t.exe /entry:main %t.obj
+# RUN: llvm-readobj -sections %t.exe | FileCheck -check-prefix=NODEBUG %s
# CHECK: Name: .text
# CHECK: Name: .debug_abbrev
@@ -10,6 +16,13 @@
# CHECK: Name: .debug_pubtypes
# CHECK: Name: .reloc
+# NODEBUG: Name: .text
+# NODEBUG-NOT: Name: .debug_abbrev
+# NODEBUG-NOT: Name: .debug_info
+# NODEBUG-NOT: Name: .debug_line
+# NODEBUG-NOT: Name: .debug_pubnames
+# NODEBUG-NOT: Name: .debug_pubtypes
+# NODEBUG: Name: .reloc
--- !COFF
header:
Modified: lld/trunk/test/COFF/symtab.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/symtab.test?rev=335946&r1=335945&r2=335946&view=diff
==============================================================================
--- lld/trunk/test/COFF/symtab.test (original)
+++ lld/trunk/test/COFF/symtab.test Thu Jun 28 23:08:25 2018
@@ -3,6 +3,8 @@
# RUN: llvm-readobj -symbols %t.exe | FileCheck %s
# RUN: lld-link /debug:dwarf /opt:noref /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
# RUN: llvm-readobj -symbols %t.exe | FileCheck %s
+# RUN: lld-link /debug:symtab /opt:noref /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
+# RUN: llvm-readobj -symbols %t.exe | FileCheck %s
# RUN: lld-link /debug /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
# RUN: llvm-readobj -symbols %t.exe | FileCheck -check-prefix=NO %s
More information about the llvm-commits
mailing list