[PATCH] D77652: [obj2yaml] - Fix the issue with dumping empty sections when dumping program headers.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 00:30:51 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/tools/obj2yaml/elf2yaml.cpp:314-316
+  if (!SHdr.sh_size)
+    return SHdr.sh_addr >= Phdr.p_vaddr &&
+           SHdr.sh_addr <= Phdr.p_vaddr + Phdr.p_memsz;
----------------
grimar wrote:
> jhenderson wrote:
> > jhenderson wrote:
> > > I think this will change the behaviour for a (malformed) input with an empty section in the middle of a segment, where that section has a mismatching address. I'd be inclined to say that the section should be listed in the segment, although I'm not sure if it actually matters either way.
> > I'd find `Shdr.sh_size == 0` to be easier to read.
> I think the right way would be to implement the missing functionality first (e.g. I'll post a patch for SHT_NOBITS soon, this diff is the preparation),
> and then we can add support for tricky mailformed cases (if we want to support them) when we'll see the whole code.
I'm not sure I follow what you mean by "missing functionality" here?


================
Comment at: llvm/tools/obj2yaml/elf2yaml.cpp:313
+  // virtual address space of the segment. This means it is not included in
+  // segment and we should ignore it.
+  if (SHdr.sh_size == 0)
----------------
the segment


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

https://reviews.llvm.org/D77652





More information about the llvm-commits mailing list