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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 02:40:00 PDT 2020


grimar 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;
----------------
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.


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

https://reviews.llvm.org/D77652





More information about the llvm-commits mailing list