<div dir="ltr">Seems easy to be compatible with those other section names - though I don't feel too strongly. Maybe at least a comment in the source that they might be implemented if needed, etc?<br><br>(also I should read up on the gnu.linkonce.wi sections... )</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 31, 2018 at 2:26 PM Fangrui Song via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: maskray<br>
Date: Tue Jul 31 14:26:35 2018<br>
New Revision: 338443<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=338443&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=338443&view=rev</a><br>
Log:<br>
[llvm-objcopy] Make --strip-debug strip .gdb_index<br>
<br>
Summary:<br>
See binutils-gdb/bfd/elf.c, GNU objcopy also strips .stab* (STABS)<br>
.line* (DWARF 1) .gnu.linkonce.wi.* (linkonce section for .debug_info) but<br>
I'm not sure we need to be compatible with it.<br>
<br>
Reviewers: dblaikie, alexshap, jakehehrlich, jhenderson<br>
<br>
Reviewed By: alexshap, jakehehrlich<br>
<br>
Subscribers: aprantl, JDevlieghere, jakehehrlich, llvm-commits<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D50100" rel="noreferrer" target="_blank">https://reviews.llvm.org/D50100</a><br>
<br>
Modified:<br>
    llvm/trunk/test/tools/llvm-objcopy/strip-debug.test<br>
    llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp<br>
<br>
Modified: llvm/trunk/test/tools/llvm-objcopy/strip-debug.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/strip-debug.test?rev=338443&r1=338442&r2=338443&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/strip-debug.test?rev=338443&r1=338442&r2=338443&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/tools/llvm-objcopy/strip-debug.test (original)<br>
+++ llvm/trunk/test/tools/llvm-objcopy/strip-debug.test Tue Jul 31 14:26:35 2018<br>
@@ -67,7 +67,7 @@<br>
 # RUN: llvm-objcopy --strip-debug %t.thin.a %t2.thin.a<br>
 # RUN: cat %t.thin.a | FileCheck %s --check-prefix=VERIFY-THIN-ARCHIVE<br>
 # RUN: cat %t2.thin.a | FileCheck %s --check-prefix=VERIFY-THIN-ARCHIVE<br>
- <br>
+<br>
 # VERIFY-THIN-ARCHIVE: !<thin><br>
<br>
 # Verify that the member of a thin archive was properly modified.<br>
@@ -94,6 +94,12 @@ Sections:<br>
   - Name:            .debugfoo<br>
     Type:            SHT_PROGBITS<br>
     Content:         "00000000"<br>
+  - Name:            .zdebugfoo<br>
+    Type:            SHT_PROGBITS<br>
+    Content:         "00000000"<br>
+  - Name:            .gdb_index<br>
+    Type:            SHT_PROGBITS<br>
+    Content:         "00000000"<br>
   - Name:            .text<br>
     Type:            SHT_PROGBITS<br>
     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]<br>
<br>
Modified: llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp?rev=338443&r1=338442&r2=338443&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp?rev=338443&r1=338442&r2=338443&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp (original)<br>
+++ llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp Tue Jul 31 14:26:35 2018<br>
@@ -186,7 +186,8 @@ LLVM_ATTRIBUTE_NORETURN void reportError<br>
 } // end namespace llvm<br>
<br>
 static bool IsDebugSection(const SectionBase &Sec) {<br>
-  return Sec.Name.startswith(".debug") || Sec.Name.startswith(".zdebug");<br>
+  return Sec.Name.startswith(".debug") || Sec.Name.startswith(".zdebug") ||<br>
+         Sec.Name == ".gdb_index";<br>
 }<br>
<br>
 static bool IsDWOSection(const SectionBase &Sec) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>