[llvm] r338443 - [llvm-objcopy] Make --strip-debug strip .gdb_index

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 6 21:52:40 PDT 2018


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?

(also I should read up on the gnu.linkonce.wi sections... )

On Tue, Jul 31, 2018 at 2:26 PM Fangrui Song via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> 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) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180806/bc41db5e/attachment.html>


More information about the llvm-commits mailing list