diff options
author | Sid Manning <sidneym@quicinc.com> | 2019-11-05 11:13:18 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-11-05 11:14:12 -0800 |
commit | 6cd47f9dd7dd664ff855fb0d1ed26bf5e4bb77fc (patch) | |
tree | 14e23da581acc68fcb6095d0c73c9290339e1b4d /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | f1b4c4bfd0b55c3c0abbc73e1159117f8533aca3 (diff) | |
download | bcm5719-llvm-6cd47f9dd7dd664ff855fb0d1ed26bf5e4bb77fc.tar.gz bcm5719-llvm-6cd47f9dd7dd664ff855fb0d1ed26bf5e4bb77fc.zip |
[llvm-objdump] Fix spurious "The end of the file was unexpectedly encountered" if a SHT_NOBITS sh_offset is larger than the file size
llvm-objdump -D this file:
int a[100000];
int main() { return 0; }
Will produce an error: "The end of the file was unexpectedly encountered".
This happens because of a check in Binary.h checkOffset. (Addr + Size > M.getBufferEnd()).
The sh_offset and sh_size fields can be ignored for SHT_NOBITS sections.
Fix the error by changing ELFObjectFile<ELFT>::getSectionContents to use
the file base for SHT_NOBITS sections.
Reviewed By: grimar, MaskRay
Differential Revision: https://reviews.llvm.org/D69192
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions