[PATCH] D76537: [obj2yaml] Dump ELF program headers

Aaron Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 20 19:31:54 PDT 2020


asmith created this revision.
asmith added reviewers: jhenderson, jakehehrlich, Hui, rupprecht, espindola, alexshap.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
asmith edited the summary of this revision.

This is needed to add a yaml test for D67689 <https://reviews.llvm.org/D67689> to test 'llvm-objcopy --gap-fill'.

This has the following changes:

      

1. Introduce isSectionWithinPhdr in ELF.h. This extracts similar functionality from llvm-readobj/ELFDumper and is intended to work for llvm-readobj, obj2yaml and llvm-objcopy (to replace its sectionWithinSegement function). A major change is that we check the offset OR VMA to determine if a section is within the range of a program header. This is different from ELFDumper that checks both. All tests pass with this change.

2. Dump elf program headers. The program header fields: offset/filesz/memsz are not optional. However for objects via yaml2obj that lack a section to segment mapping these fields are not dumped.

3. Add a unit test for obj2yaml.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76537

Files:
  llvm/include/llvm/Object/ELF.h
  llvm/test/Object/obj2yaml.test
  llvm/test/tools/obj2yaml/program-headers.test
  llvm/tools/llvm-readobj/ELFDumper.cpp
  llvm/tools/obj2yaml/elf2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76537.251819.patch
Type: text/x-patch
Size: 15099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200321/e316079f/attachment.bin>


More information about the llvm-commits mailing list