[PATCH] D63879: [yaml2obj] - Allow overriding sh_offset field from the YAML.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 01:34:09 PDT 2019


grimar added a comment.

In D63879#1560868 <https://reviews.llvm.org/D63879#1560868>, @jhenderson wrote:

> I'm not sure the correct behaviour for an explicit offset is clear-cut. I'd think that it causes the section contents to be written at the specified offset, not that it just writes an arbitrary value in sh_offset. I've had times when I want to put my sections at a specific offset, but could only do this with tricks to do with alignment or padding sections. I'd expect an Offset field would resolve this issue (note that this is what happens for ProgramHeaders already).


Yes, I had the same concerns. But I think it is fine generally: at any time we still can introduce a new field that might have a behavior you describe.
Its name can be `SecOffset`. See: currently all YAML fields names we have do not match the ELF fields name directly. E.g. we have `Name` but it doesn't match `sh_name`.
In this patch I named the field `ShOffset` to match the `sh_offset`. We can have an agreement that if a field matches the ELF field name then its intention os to
override the field's value. It is in line with D63771 <https://reviews.llvm.org/D63771> btw.


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

https://reviews.llvm.org/D63879





More information about the llvm-commits mailing list