Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build/make: set the page size #503

Merged
merged 1 commit into from
Aug 23, 2023
Merged

build/make: set the page size #503

merged 1 commit into from
Aug 23, 2023

Conversation

bradjc
Copy link
Contributor

@bradjc bradjc commented Aug 15, 2023

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.

build.rs Outdated
// 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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to include this in libtock_build_scripts::auto_layout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was users may want this but not auto_layout.

We could add it to the build-scripts crate.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@bradjc
Copy link
Contributor Author

bradjc commented Aug 22, 2023

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 jrvanwhy added the upkeep Indicates a PR is upkeep as defined by the code review policy. label Aug 22, 2023
@jrvanwhy jrvanwhy added this pull request to the merge queue Aug 23, 2023
Merged via the queue into master with commit e80cd7b Aug 23, 2023
3 checks passed
@jrvanwhy jrvanwhy deleted the linker-page-size branch August 23, 2023 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeep Indicates a PR is upkeep as defined by the code review policy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants