[PATCH] D74755: [llvm-objcopy] Attribute an empty section to a segment ending at its address

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 02:06:24 PDT 2020


jhenderson added a comment.

In D74755#1998620 <https://reviews.llvm.org/D74755#1998620>, @jhenderson wrote:

> `BinaryWriter::finalize` used to populate list of segments for ordering.


At first glance, I thought that this was going to cause a significant issue, as a different set of segments could end up getting picked, and therefore behaviour might end up being different. However, when looking at the code carefully, it looks like `OrderedSegments` in the function is only used to set the physical address to the virtual address when there are no physical addresses set amongst these sections. It looks like there's a lot of dead code in this area that can be tidied up (why order the segments? why does a comment refer to laying them out etc?). The only effect as far as I can tell of setting the physical address is so that it can be used in the calculation already highlighted above. As a result, as long as all ParentSegments have their address updated in this way, it doesn't really matter which version is used.

Consequently, I cannot see any behaviour change that could be caused in binary output by this change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74755





More information about the llvm-commits mailing list