Skip to content

riscv-rt: Add uninit section #329

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions riscv-rt/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- New `post-init` feature to run a Rust `__post_init` function before jumping to `main`.
- New `#[riscv_rt::post_init]` attribute to aid in the definition of the `__post_init` function.
- Added `.uninit` section to the linker file. Due to its similarities with `.bss`, the
linker will place this new section in `REGION_BSS`.

### Changed

Expand Down
13 changes: 13 additions & 0 deletions riscv-rt/link.x.in
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ SECTIONS
. = ALIGN(${ARCH_WIDTH});
__ebss = .;

/* Uninitialized data segment. In contrast with .bss, .uninit is not initialized to zero by
* the runtime, and might contain residual data from previous executions or random values
* if not explicitly initialized. While .bss and .uninit are different sections, they are
* both allocated at REGION_BSS, as their purpose is similar. */
.uninit (NOLOAD) : ALIGN(${ARCH_WIDTH})
{
. = ALIGN(${ARCH_WIDTH});
__suninit = .;
*(.uninit .uninit.*);
. = ALIGN(${ARCH_WIDTH});
__euninit = .;
} > REGION_BSS

/* fictitious region that represents the memory available for the heap */
.heap (NOLOAD) : ALIGN(4)
{
Expand Down
Loading