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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 07:40:59 PDT 2019


jhenderson added a comment.

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).

Unfortunately, I think this change conflicts with that desire, and I don't see any easy way of reconciling the differences.



================
Comment at: lib/ObjectYAML/ELFYAML.cpp:915
+
+  assert(!IO.outputting());
+  IO.mapOptional("ShOffset", Section.ShOffset);
----------------
This assert seems a bit out-of-place?


================
Comment at: lib/ObjectYAML/ELFYAML.cpp:916
+  assert(!IO.outputting());
+  IO.mapOptional("ShOffset", Section.ShOffset);
 }
----------------
I'd call this "Offset" not "ShOffset", to better match the other fields.


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

https://reviews.llvm.org/D63879





More information about the llvm-commits mailing list