[PATCH] D63807: [llvm-objcopy] Add --only-keep-debug for ELF

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 00:04:15 PDT 2019


MaskRay added a comment.

>   Do you have thoughts on just doing the common case, just Sec.Flags & (SHF_ALLOC | SHF_GROUP) && Sec.Type != SHT_NOTE and not having SectionBase::clearSectionContents abort

This rule looks good enough.

> Also I will move the sections to the start of their segments as @jhenderson described in D40523 <https://reviews.llvm.org/D40523>.

My feeling is that segments are not important. If segments are laid out weirdly after objcopy --only-keep-debug, I think it doesn't matter if llvm-objcopy also fails to layout the segments in a sensible way. The important thing here is that debuggers can correctly load debug info from such --only-keep-debug processed files. So I asked you test the workflow:

  # Say the executable is a
  llvm-objcopy --only-keep-debug a a.dbg
  llvm-objcopy --strip-debug a b
  llvm-objcopy --add-gnu-debuglink=a.dbg b
  # gdb b  and lldb b


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63807/new/

https://reviews.llvm.org/D63807





More information about the llvm-commits mailing list