[PATCH] D69192: llvm-objdump can error out with an unexpected EOF error if .bss is larger than the file being dumped.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 01:10:58 PDT 2019


grimar added inline comments.


================
Comment at: llvm/include/llvm/Object/ELFObjectFile.h:727
+  if (EShdr->sh_type == ELF::SHT_NOBITS)
+    return makeArrayRef((const uint8_t *)base() + EShdr->sh_offset, 0);
   if (std::error_code EC =
----------------
MaskRay wrote:
> Delete `+ sh_offset` to solve the problem I described in a previous comment.
It is strange to know that sh_offset can be greater than the file size.

If we want to have this change and not error out, I'd add a comment and a one more test case for
this (yaml2obj allows overriding the sh_offset with use of "ShOffset" field).


================
Comment at: llvm/test/tools/llvm-objdump/X86/elf-disassemble-bss.test:16
+  Machine:         EM_X86_64
+  Entry:           0x00000000004003E0
+Sections:
----------------
As I mentioned earlier, you do not need this, `Address` and `AddressAlign` fields below.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D69192





More information about the llvm-commits mailing list