build/make: set the page size#503
Merged
Merged
Conversation
jrvanwhy
reviewed
Aug 15, 2023
| // Configure the alignment size for the linker. This prevents the linker | ||
| // from assuming very large pages (i.e. 65536 bytes) and unnecessarily | ||
| // inserting additional padding into the output ELF. | ||
| println!("cargo:rustc-link-arg=-zmax-page-size=4096"); |
Collaborator
There was a problem hiding this comment.
Any reason not to include this in libtock_build_scripts::auto_layout?
Contributor
Author
There was a problem hiding this comment.
My thinking was users may want this but not auto_layout.
We could add it to the build-scripts crate.
Collaborator
There was a problem hiding this comment.
I feel think this is part of configuring the layout for a libtock-rs app, and therefore belongs in auto_layout.
Otherwise lld seems to assume 0x10000 sized pages and tries to align the output segments to 0x10000. This often causes elfs with large padding regions before the first segment we actually want to load on the board.
c2e478f to
6e1d0ca
Compare
Contributor
Author
|
Moved. I think when you spend too much time thinking about linkers it starts to change you and you start to think that others might also want to think about linkers but in reality they don't and I agree it's better to just fix this option for everyone and no one will ever notice or care. |
jrvanwhy
approved these changes
Aug 22, 2023
ppannuto
approved these changes
Aug 23, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without setting this, lld seems to assume 0x10000 sized pages and tries to align the output segments to 0x10000. This often causes elfs with large padding regions before the first segment we actually want to load on the board.
See tock/elf2tab#75 for further discussion.