[PATCH] D63771: [yaml2obj] - Allow overriding e_shentsize, e_shoff, e_shnum and e_shstrndx fields in the YAML.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 04:30:58 PDT 2019


grimar added inline comments.


================
Comment at: test/tools/yaml2obj/elf-header-sh-fields.yaml:43-44
+## Finally, we use the same YAML as above, but set e_shentsize to 1.
+## Check the result using raw output from 'od' because llvm-readelf
+## is unable to dump such headers.
+
----------------
jhenderson wrote:
> FWIW, I think this is a bug in llvm-readelf. I reckon it should be able to dump the file header regardless of the values, unless it actually has to reference something else (e.g. for many sections).
Yes, probably. 
One of problems is that even before executing the readelf's main logic,
`llvm::Object::ELFObjectFile<ELFT>` tries to scan the sections really early during creation of the object from buffer: https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Object/ELFObjectFile.h#L939
It is not obvious for me why that is done in that way and it that place and not later. I'll try to investingate it.



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

https://reviews.llvm.org/D63771





More information about the llvm-commits mailing list