[llvm] r338443 - [llvm-objcopy] Make --strip-debug strip .gdb_index
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 31 14:26:35 PDT 2018
Author: maskray
Date: Tue Jul 31 14:26:35 2018
New Revision: 338443
URL: http://llvm.org/viewvc/llvm-project?rev=338443&view=rev
Log:
[llvm-objcopy] Make --strip-debug strip .gdb_index
Summary:
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.
Reviewers: dblaikie, alexshap, jakehehrlich, jhenderson
Reviewed By: alexshap, jakehehrlich
Subscribers: aprantl, JDevlieghere, jakehehrlich, llvm-commits
Differential Revision: https://reviews.llvm.org/D50100
Modified:
llvm/trunk/test/tools/llvm-objcopy/strip-debug.test
llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp
Modified: llvm/trunk/test/tools/llvm-objcopy/strip-debug.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/strip-debug.test?rev=338443&r1=338442&r2=338443&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/strip-debug.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/strip-debug.test Tue Jul 31 14:26:35 2018
@@ -67,7 +67,7 @@
# RUN: llvm-objcopy --strip-debug %t.thin.a %t2.thin.a
# RUN: cat %t.thin.a | FileCheck %s --check-prefix=VERIFY-THIN-ARCHIVE
# RUN: cat %t2.thin.a | FileCheck %s --check-prefix=VERIFY-THIN-ARCHIVE
-
+
# VERIFY-THIN-ARCHIVE: !<thin>
# Verify that the member of a thin archive was properly modified.
@@ -94,6 +94,12 @@ Sections:
- Name: .debugfoo
Type: SHT_PROGBITS
Content: "00000000"
+ - Name: .zdebugfoo
+ Type: SHT_PROGBITS
+ Content: "00000000"
+ - Name: .gdb_index
+ Type: SHT_PROGBITS
+ Content: "00000000"
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Modified: llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp?rev=338443&r1=338442&r2=338443&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp Tue Jul 31 14:26:35 2018
@@ -186,7 +186,8 @@ LLVM_ATTRIBUTE_NORETURN void reportError
} // 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) {
More information about the llvm-commits
mailing list