-----Original Message----- From: devel <devel-boun...@rtems.org> On Behalf Of Sebastian Huber Sent: Wednesday, March 3, 2021 02:40 To: devel@rtems.org Subject: [PATCH 4/4] score: Ensure stack alignment requirement
> diff --git a/cpukit/score/src/tlsallocsize.c b/cpukit/score/src/tlsallocsize.c > index e7854c677a..cba5bdcfba 100644 > --- a/cpukit/score/src/tlsallocsize.c > +++ b/cpukit/score/src/tlsallocsize.c > @@ -59,14 +59,16 @@ uintptr_t _TLS_Get_allocation_size( void ) > allocation_size = _TLS_Allocation_size; > > if ( allocation_size == 0 ) { > - allocation_size = _TLS_Heap_align_up( size ); > - alignment = _TLS_Heap_align_up( (uintptr_t) _TLS_Alignment ); > + uintptr_t stack_alignment; > + > + stack_alignment = CPU_STACK_ALIGNMENT; > + alignment = RTEMS_ALIGN_UP( (uintptr_t) _TLS_Alignment, stack_alignment > ); > > /* > * The stack allocator does not support aligned allocations. Allocate > * enough to do the alignment manually. > */ > - if ( alignment > CPU_HEAP_ALIGNMENT ) { > + if ( alignment > stack_alignment ) { > allocation_size += alignment; > } > > @@ -76,6 +78,12 @@ uintptr_t _TLS_Get_allocation_size( void ) > allocation_size += sizeof(TLS_Dynamic_thread_vector); > #endif > > + /* > + * The TLS area is allocated in the thread storage area. Each allocation > + * shall meet the stack alignment requirement. > + */ > + allocation_size = RTEMS_ALIGN_UP( allocation_size, stack_alignment ); > + > if ( _Thread_Maximum_TLS_size != 0 ) { > if ( allocation_size <= _Thread_Maximum_TLS_size ) { > allocation_size = _Thread_Maximum_TLS_size; This change drops use of size from the top of the function in calculating allocation_size; is that intentional? It seems to be causing me some problems when testing with the AArch64 code. Kinsey _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel