[PATCH] D50100: [llvm-objcopy] Make --strip-debug strip .gdb_index

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 13:11:05 PDT 2018


MaskRay created this revision.
MaskRay added a reviewer: dblaikie.
Herald added subscribers: llvm-commits, jakehehrlich, JDevlieghere, aprantl.
Herald added a reviewer: alexshap.

See binutils-gdb/bfd/elf.c, GNU objcopy also strips .stab* (STABS)
.line* (DWARF 1) .gnu.linkonce.wi.* (linkonce section for .debug_info) but
I'm not sure we need to be compatible with it.


Repository:
  rL LLVM

https://reviews.llvm.org/D50100

Files:
  tools/llvm-objcopy/llvm-objcopy.cpp


Index: tools/llvm-objcopy/llvm-objcopy.cpp
===================================================================
--- tools/llvm-objcopy/llvm-objcopy.cpp
+++ tools/llvm-objcopy/llvm-objcopy.cpp
@@ -186,7 +186,8 @@
 } // end namespace llvm
 
 static bool IsDebugSection(const SectionBase &Sec) {
-  return Sec.Name.startswith(".debug") || Sec.Name.startswith(".zdebug");
+  return Sec.Name.startswith(".debug") || Sec.Name.startswith(".zdebug") ||
+         Sec.Name == ".gdb_index";
 }
 
 static bool IsDWOSection(const SectionBase &Sec) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50100.158368.patch
Type: text/x-patch
Size: 537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180731/c76e5bff/attachment.bin>


More information about the llvm-commits mailing list