Index: lld/trunk/COFF/Config.h =================================================================== --- lld/trunk/COFF/Config.h +++ lld/trunk/COFF/Config.h @@ -98,6 +98,7 @@ bool Debug = false; bool DebugDwarf = false; bool DebugGHashes = false; + bool DebugSymtab = false; bool ShowTiming = false; unsigned DebugTypes = static_cast(DebugType::None); std::vector NatvisFiles; Index: lld/trunk/COFF/Driver.cpp =================================================================== --- lld/trunk/COFF/Driver.cpp +++ lld/trunk/COFF/Driver.cpp @@ -1217,6 +1217,7 @@ !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); Index: lld/trunk/COFF/Options.td =================================================================== --- lld/trunk/COFF/Options.td +++ lld/trunk/COFF/Options.td @@ -139,6 +139,7 @@ // 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">; Index: lld/trunk/COFF/Writer.cpp =================================================================== --- lld/trunk/COFF/Writer.cpp +++ lld/trunk/COFF/Writer.cpp @@ -665,7 +665,7 @@ 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(B); Index: lld/trunk/test/COFF/sort-debug.test =================================================================== --- lld/trunk/test/COFF/sort-debug.test +++ lld/trunk/test/COFF/sort-debug.test @@ -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: Index: lld/trunk/test/COFF/symtab.test =================================================================== --- lld/trunk/test/COFF/symtab.test +++ lld/trunk/test/COFF/symtab.test @@ -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