Skip to content

aarch32-rt: Stack usage is transparent to linker #92

@umohr-irs

Description

@umohr-irs

The stacks are defined merely as pointers. This makes them not visible to the linker as memory area avoiding link time checks.
I would suggest putting them into their own NOLOAD section, maybe even in a separate memory region. This would bring the following benefits:

  • Memory usage by stacks is checked by the linker. Currently, if one defined a stack size larger than the DATA memory region, the linker is happy to generate very invalid values for the stack pointers. The same applies if the stacks collide with valid data within DATA.
  • the size utility shows the actual memory usage by the binary. Currently, the stacks are not included there.
  • Memory usage is optimized as there is no "empty" region between .uninit and the stacks. With the output of size being correct, memory usage can be controlled more closely.

By introducing a separate memory region, it still would be possible to put the stacks at a defined location in memory for those who prefer it that way.

While this all can be changed by user defined linker scripts and code, I would prefer the example code to reflect this concept to not mislead the unsuspecting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions