[PATCH] D91249: [obj2yaml] - Sort sections by file offsets when dumping them.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 02:38:58 PST 2020


jhenderson added a comment.

I'm a little confused here. If we have an ELF with sections .foo, .bar and .zed in that order in the section header table, but with offsets 0x300, 0x200, and 0x100 respectively, I'd expect the obj2yaml output to mantain at least the offset property (the section header table order is arguably less important, although if that order can be maintained too, great). This change appears to be changing the offsets of the sections. At least in `section-headers.yaml` the input offsets are 0x100, 0x200, 0x300, for .foo, .bar, .zed in that order, whereas the output offsets are 0x300, 0x100, 0x200. This isn't a faithful representation of the input. The thing that could be reordered is the `Sections:` array. I think either it could be ordered to match the section header table order (in which case there is no need for the `SectionHeaderTable` key probably), or it should be ordered according to Offset (in which case a `SectionHeaderTable` key could be added to maintain the table order).


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

https://reviews.llvm.org/D91249



More information about the llvm-commits mailing list