[PATCH] D48745: [LLD] [COFF, MinGW] Implement the GNU ld options -S/--strip-debug

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 28 23:13:11 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL335946: [COFF] Add an LLD specific option -debug:symbtab (authored by mstorsjo, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D48745?vs=153399&id=153438#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48745

Files:
  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


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
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/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<Defined>(B);
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<unsigned>(DebugType::None);
   std::vector<std::string> NatvisFiles;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48745.153438.patch
Type: text/x-patch
Size: 3564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180629/60a8afab/attachment.bin>


More information about the llvm-commits mailing list