You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FreeRTOS-Kernel/include
Keith Packard 563c57e7da
Fix TLS and stack alignment when using picolibc (#637)
Both the TLS block and stack must be correctly aligned when using
picolibc. The architecture stack alignment is represented by the
portBYTE_ALIGNMENT_MASK and the TLS block alignment is provided by the
Picolibc _tls_align() inline function for Picolibc version 1.8 and
above. For older versions of Picolibc, we'll assume that the TLS block
requires the same alignment as the stack.

For downward growing stacks, this requires aligning the start of the
TLS block to the maximum of the stack alignment and the TLS
alignment. With this, both the TLS block and stack will now be
correctly aligned.

For upward growing stacks, the two areas must be aligned
independently; the TLS block is aligned from the start of the stack,
then the tls space is allocated, and then the stack is aligned above
that.

It's probably useful to know here that the linker ensures that
variables within the TLS block are assigned offsets that match their
alignment requirements. If the TLS block itself is correctly aligned,
then everything within will also be.

I have only tested the downward growing stack branch of this patch.

Signed-off-by: Keith Packard <keithpac@amazon.com>
Co-authored-by: Keith Packard <keithpac@amazon.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2 years ago
..
FreeRTOS.h Add Thread Local Storage (TLS) support using Picolibc functions (#343) 2 years ago
StackMacros.h Normalize line endings and whitespace in source files 2 years ago
atomic.h Normalize line endings and whitespace in source files 2 years ago
deprecated_definitions.h Normalize line endings and whitespace in source files 2 years ago
event_groups.h Added support of 64bit events. (#597) 2 years ago
list.h Feature/fixing clang gnu compiler warnings (#620) 2 years ago
message_buffer.h Normalize line endings and whitespace in source files 2 years ago
mpu_prototypes.h Normalize line endings and whitespace in source files 2 years ago
mpu_wrappers.h Normalize line endings and whitespace in source files 2 years ago
newlib-freertos.h Add Thread Local Storage (TLS) support using Picolibc functions (#343) 2 years ago
picolibc-freertos.h Fix TLS and stack alignment when using picolibc (#637) 2 years ago
portable.h Normalize line endings and whitespace in source files 2 years ago
projdefs.h Added support of 64bit events. (#597) 2 years ago
queue.h Feature/fixing clang gnu compiler warnings (#620) 2 years ago
semphr.h Normalize line endings and whitespace in source files 2 years ago
stack_macros.h Feature/fixing clang gnu compiler warnings (#620) 2 years ago
stdint.readme Normalize line endings and whitespace in source files 2 years ago
stream_buffer.h Normalize line endings and whitespace in source files 2 years ago
task.h Feature/fixing clang gnu compiler warnings (#620) 2 years ago
timers.h Feature/fixing clang gnu compiler warnings (#620) 2 years ago