aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ELF.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-03-28 01:00:43 -0700
committerFangrui Song <i@maskray.me>2022-03-28 01:00:43 -0700
commit11a8fc685692f56b011f851d974f0cac534f2cb8 (patch)
treee9ed3cc2efe51c30410a2c711263ce00c7d22454 /llvm/lib/Object/ELF.cpp
parent423af54cbef7b90199e01162dcea6d3e62539e8c (diff)
downloadllvm-11a8fc685692f56b011f851d974f0cac534f2cb8.zip
llvm-11a8fc685692f56b011f851d974f0cac534f2cb8.tar.gz
llvm-11a8fc685692f56b011f851d974f0cac534f2cb8.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Object/ELF.cpp')
-rw-r--r--llvm/lib/Object/ELF.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp
index c4e4887..bcef7ce 100644
--- a/llvm/lib/Object/ELF.cpp
+++ b/llvm/lib/Object/ELF.cpp
@@ -568,11 +568,9 @@ Expected<typename ELFT::DynRange> ELFFile<ELFT>::dynamicEntries() const {
}
if (Dyn.empty())
- // TODO: this error is untested.
return createError("invalid empty dynamic section");
if (Dyn.back().d_tag != ELF::DT_NULL)
- // TODO: this error is untested.
return createError("dynamic sections must be DT_NULL terminated");
return Dyn;