[PATCH] D78304: [yaml2obj] - Program headers: introduce the `POffset` and add an additional check for `Offset`

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 20 03:11:23 PDT 2020


grimar added a comment.

In D78304#1991775 <https://reviews.llvm.org/D78304#1991775>, @jhenderson wrote:

> Can't the regular Offset field be used for this instead? Yes, that might mean that the offset is greater than the minimum section offset, but I think that's okay?


That is what I was not sure is OK and why this patch appeared. We have a few test cases like:

  Sections:
    - Name: .dynamic
      Type: SHT_DYNAMIC
      Entries:
        - Tag:   DT_NULL
          Value: 0
  ProgramHeaders:
    - Type:    PT_DYNAMIC
      Offset: 0xffff0000
      Sections:
        - Section: .dynamic

I read it as (knowing the internal logic): "take the list of 'Sections` and assign the proper memory size, file size and the offset.
But since the "Offset" is specified, it itself reads as "and change the offset to something", what can be valid because we might need the offset to be lower than the minimum section offset.
But when it is not lower its meaning intersects with the section list. It looks like an issue because it is not clear what the correct logic should be probably? E.g. which memory and file size we want to set?
Using of "POffset" here would say: "take the list of sections, calculate everything as usual, but override the final offset"

Does it make sense?


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

https://reviews.llvm.org/D78304





More information about the llvm-commits mailing list