Closed dtolnay closed 5 years ago
From the linked articles, I can find two issues that may make things difficult:
Section names must be 8 characters or less. Since 2 characters are taken up by the sorting marker, this leaves us only 6 characters for the unique identifier đ„
Sections may be padded with zeroes at the beginning and end. So we'll need to either restrict ourselves to NonZero
types or add a tag to each entry.
Implemented in #4, published in 0.1.2.
Found some more context for the padding issue on Windows:
[...] it fails to take into account another detail of linker sections: intra-section padding.
The linker will add padding after a fragment in order to satisfy any alignment requirements of the subsequent fragment. Thatâs expected.
What most people arenât aware of is that the linker is permitted but not required to add padding after each fragment, up to the sectionâs alignment. In practice, you are likely to see this âunnecessaryâ padding when using incremental linking.
In all cases, the padding bytes (if any) will be zero.
Seems like padding could be added when using incremental linking. Can Rust code use incremental linking and can we reproduce this?
Relevant reading: