I also noticed that when elf_update recomputes the section layout,
it leaves the section offset of SHT_NOBITS and SHT_NULL sections alone
while the others are updated. elfutils sets the offset of the section
based on the ending of the previous section. Does this offset have any
meaning, or is it just arbitrary? Either way, maybe it makes sense to
set it to the end of the previous section to avoid inheriting the
value from the original section layout.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Copied here to keep details in one place:
it leaves the section offset of SHT_NOBITS and SHT_NULL sections alone
while the others are updated. elfutils sets the offset of the section
based on the ending of the previous section. Does this offset have any
meaning, or is it just arbitrary? Either way, maybe it makes sense to
set it to the end of the previous section to avoid inheriting the
value from the original section layout.