dtolnay / linkme

Safe cross-platform linker shenanigans
Apache License 2.0
646 stars 41 forks source link

Windows support for distributed slice #2

Closed dtolnay closed 5 years ago

dtolnay commented 5 years ago

Relevant reading:

lambda-fairy commented 5 years ago

From the linked articles, I can find two issues that may make things difficult:

dtolnay commented 5 years ago

Implemented in #4, published in 0.1.2.

oberrich commented 2 months ago

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.

image

Seems like padding could be added when using incremental linking. Can Rust code use incremental linking and can we reproduce this?