-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
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
DATAmemory region, the linker is happy to generate very invalid values for the stack pointers. The same applies if the stacks collide with valid data withinDATA. - the
sizeutility 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
.uninitand the stacks. With the output ofsizebeing 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
Labels
No labels