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

[google] Implement static linking #66

Merged
merged 5 commits into from
Feb 6, 2019
Merged

Conversation

jrvanwhy
Copy link
Collaborator

@jrvanwhy jrvanwhy commented Jan 31, 2019

Note: this is a google-branch version of #64.

Because ROPI-RWPI support in the compiler is incomplete, this changes the libtock-rs layout file to allow Rust apps to be statically-linked. With this change in place, all language features should work correctly.

The caveat is we lose the ability to dynamically load Tock applications and we need to predict the size of the TBF headers in the application image. When compiler support for ROPI-RWPI is complete I'll implement any necessary dynamic relocation steps and reverse this change.

This change depends on Initialize .data and .bss in libtock-rs. and Implement a --protected-region-size... in elf2tab.

This should do all necessary initialization except for dynamic relocations. We do not perform dynamic relocations yet because it's unclear what they will look like for ROPI-RWPI.
@jrvanwhy jrvanwhy changed the title Implement static linking [google] Implement static linking Jan 31, 2019
Initialize .data and .bss in libtock-rs.
Philipp Vollmer and others added 3 commits February 2, 2019 12:41
Revert "Initialize .data and .bss in libtock-rs."
Proper compiler support for ROPI-RWPI relocation is a ways off; in the meantime, this lets Rust apps work on Tock.

The application will need to know where it will be loaded in RAM, which requires adjusting the kernel's linker script. To support the existing examples, I guessed where an application would be loaded on the nRF52-DK.

An application also needs to know where its .text will end up, which is immediately after the protected region. To make this predictable, we need to fix the protected region size. This is done using elf2tab's --protected-region-size, added in tock/elf2tab#6. Users of libtock-rs will need a recent elf2tab and must pass an appropriate value for protected-region-size to elf2tab.
@jrvanwhy
Copy link
Collaborator Author

jrvanwhy commented Feb 6, 2019

We should merge #67 before this.

Copy link
Collaborator

@phil-levis-google phil-levis-google left a comment

Choose a reason for hiding this comment

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

Looks good to me. I'm glad this has been solved and we now have Rust support!

@jrvanwhy jrvanwhy merged commit 3dd90aa into tock:google Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants