[PATCH] D122505: [llvm-objdump] --private-headers: change errors to warnings for dynamic section dumping

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 13:48:39 PDT 2022


MaskRay created this revision.
MaskRay added reviewers: jhenderson, raj.khem.
Herald added subscribers: StephenFan, rupprecht, hiraditya, emaste.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Fix #54456: `objcopy --only-keep-debug` produces a linked image with invalid
empty dynamic section. llvm-objdump -p currently reports an error which seems
excessive.

  % llvm-readelf -l a.out
  llvm-readelf: warning: 'a.out': no valid dynamic table was found
  ...

Follow the spirit of llvm-readelf -l and report a warning instead. This
improves objdump compatibility in that the exit code is now 0 instead of 1.

  % llvm-objdump -p a.out  # new behavior
  ...
  Program Header:
  llvm-objdump: warning: 'a.out': invalid empty dynamic section
  % objdump -p a.out
  ...
  Dynamic Section:


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122505

Files:
  llvm/lib/Object/ELF.cpp
  llvm/test/tools/llvm-objdump/ELF/dynamic-malformed.test
  llvm/test/tools/llvm-objdump/ELF/invalid-phdr.test
  llvm/test/tools/llvm-objdump/ELF/program-headers.test
  llvm/tools/llvm-objdump/ELFDump.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122505.418319.patch
Type: text/x-patch
Size: 5847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220325/1b0a888d/attachment.bin>


More information about the llvm-commits mailing list