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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 01:51:11 PDT 2019


MaskRay added a comment.

It'll be good to check if the following workflow works:

  # 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



================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:85
+void SectionBase::clearSectionContents() {
+  assert(0 && "Cannot clear this sections contents");
+}
----------------
abrachet wrote:
> jhenderson wrote:
> > This would usually be `llvm_unreachable`. However, I'm wondering why you're not just ignoring this case?
> I'll change this later, for now I think its a good way to check when it is being called on an unexpected section. Although probably llvm_unreachable will also aborts with the message?
This will abort for DynamicRelocationSection (.rela.dyn)


================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1009
+void Section::clearSectionContents() {
+  this->Contents = ArrayRef<uint8_t>();
+}
----------------
`this->` is redundant.


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

https://reviews.llvm.org/D63807





More information about the llvm-commits mailing list