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>
2023-03-06 11:59:39 +05:30
..
atomic.h Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
deprecated_definitions.h Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
event_groups.h Added support of 64bit events. (#597) 2023-02-03 07:34:02 -07:00
FreeRTOS.h Add Thread Local Storage (TLS) support using Picolibc functions (#343) 2023-03-02 21:56:04 +05:30
list.h Feature/fixing clang gnu compiler warnings (#620) 2023-02-23 23:35:04 +05:30
message_buffer.h Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
mpu_prototypes.h Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
mpu_wrappers.h Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
newlib-freertos.h Add Thread Local Storage (TLS) support using Picolibc functions (#343) 2023-03-02 21:56:04 +05:30
picolibc-freertos.h Fix TLS and stack alignment when using picolibc (#637) 2023-03-06 11:59:39 +05:30
portable.h Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
projdefs.h Added support of 64bit events. (#597) 2023-02-03 07:34:02 -07:00
queue.h Feature/fixing clang gnu compiler warnings (#620) 2023-02-23 23:35:04 +05:30
semphr.h Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
stack_macros.h Feature/fixing clang gnu compiler warnings (#620) 2023-02-23 23:35:04 +05:30
StackMacros.h Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
stdint.readme Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
stream_buffer.h Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
task.h Feature/fixing clang gnu compiler warnings (#620) 2023-02-23 23:35:04 +05:30
timers.h Feature/fixing clang gnu compiler warnings (#620) 2023-02-23 23:35:04 +05:30