[PATCH] D75342: [obj2yaml] - Teach tool to dump program headers.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 1 23:14:35 PST 2020


MaskRay added a comment.

The dumpProgramHeaders() logic is similar to `llvm-objcopy/ELF/Object.cpp:sectionWithSegment`. It also reminds me of D74755 <https://reviews.llvm.org/D74755>... The attribution of an empty section on the boundary between two segments will not affect obj2yaml correctness.



================
Comment at: llvm/tools/obj2yaml/elf2yaml.cpp:209
+      ELFYAML::Section* Sec = *It++;
+      uint64_t VA = Sec->Address.getValueOr(llvm::yaml::Hex64(0));
+      if (VA < PH.VAddr || (VA + Sec->OriginalSize > PH.VAddr + Phdr.p_memsz))
----------------
I haven't carefully read through the code. Just raise an opinion.

For non-SHT_NOBITS sections, sh_offset/p_offset works better than sh_addr/p_vaddr.
For SHT_NOBITS sections, sh_offset can be ignored. See D58426.


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

https://reviews.llvm.org/D75342





More information about the llvm-commits mailing list