[all-commits] [llvm/llvm-project] 11a8fc: [llvm-objdump] --private-headers: change errors to...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Mar 28 01:01:10 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 11a8fc685692f56b011f851d974f0cac534f2cb8
      https://github.com/llvm/llvm-project/commit/11a8fc685692f56b011f851d974f0cac534f2cb8
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-03-28 (Mon, 28 Mar 2022)

  Changed paths:
    M llvm/lib/Object/ELF.cpp
    A llvm/test/tools/llvm-objdump/ELF/dynamic-malformed.test
    M llvm/test/tools/llvm-objdump/ELF/invalid-phdr.test
    M llvm/test/tools/llvm-objdump/ELF/program-headers.test
    M llvm/tools/llvm-objdump/ELFDump.cpp

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

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 (D64472) and report a warning instead.
This allows later files to be dumped despite warnings for an input file, and
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:

```

Reviewed By: jhenderson, raj.khem

Differential Revision: https://reviews.llvm.org/D122505




More information about the All-commits mailing list