[yaml2obj] Make e_phoff and e_phentsize 0 if there are no program headers
authorAlex Brachet <alexbrachetmialot@gmail.com>
Fri, 6 Sep 2019 02:27:55 +0000 (02:27 +0000)
committerAlex Brachet <alexbrachetmialot@gmail.com>
Fri, 6 Sep 2019 02:27:55 +0000 (02:27 +0000)
commit0b69c59656f564d1aa68ec6b5c1b0be55475a864
tree5b998a7b33a07f518cf0d37d2cc752571a8f8e9c
parentb1cf175271820b17c27edfd483c2ab52ce0afcfb
[yaml2obj] Make e_phoff and e_phentsize 0 if there are no program headers

Summary: It says [[ http://www.sco.com/developers/gabi/latest/ch4.eheader.html | here ]] that if there are no program headers than e_phoff should be 0, but currently it is always set after the header. GNU's `readelf` (but not `llvm-readelf`) complains about this: `readelf: Warning: possibly corrupt ELF header - it has a non-zero program header offset, but no program headers`.

Reviewers: jhenderson, grimar, MaskRay, rupprecht

Reviewed By: jhenderson, grimar, MaskRay

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 371162
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/test/tools/yaml2obj/elf-no-phdrs.yaml [new file with mode: 0644]