[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 06:25:29 PDT 2020


grimar added a comment.

There is some misunderstanding it seems:

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

> In D78304#1991909 <https://reviews.llvm.org/D78304#1991909>, @grimar wrote:
>
> > Does it make sense?
>
>
> I think the problem here is that we have two competing sources of information for how to layout a program header - the Sections list and the Offset key. Possibly me mental model is outdated, but I thought the layout of the program headers had no effect on that of the sections? In other words, I thought that a section offset was based purely on its alignment and the positions and sizes of any sections/fillers/headers before it?


It is correct.

> but a forced Offset greater than the start offset of some section seems invalid, and should therefore generate an error?

This is what this patch does. It introduces an error when the program header `Offset` forced is greater than the minimal section offset.
But since we need a way to set an arbitrary value for some tests (to override `p_offset`), I've introduced `POffset`, which does not affect on the properties of a program header, it just overrides the `p_offset` field without any checks.

So I think the behavior you described is exactly what this patch does, or not ?


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

https://reviews.llvm.org/D78304





More information about the llvm-commits mailing list