[PATCH 07/13] sptls02: Increase alignment of a TLS object

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 30 09:21:30 UTC 2022


Increase the alignment of a TLS object to the minimum stack size.  This may
provoke overflows in the TLS area calculations.
---
 testsuites/sptests/sptls02/init.cc | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/testsuites/sptests/sptls02/init.cc b/testsuites/sptests/sptls02/init.cc
index 39fc2a2a24..081b8c160d 100644
--- a/testsuites/sptests/sptls02/init.cc
+++ b/testsuites/sptests/sptls02/init.cc
@@ -48,7 +48,7 @@ alignas(256) static thread_local long a256 = 256;
 
 static thread_local long i0;
 
-alignas(512) static thread_local long a512;
+alignas(RTEMS_MINIMUM_STACK_SIZE) static thread_local long a;
 
 int seven()
 {
@@ -61,7 +61,7 @@ static void clobber()
 	i123 = 0xdead0001;
 	a256 = 0xdead0002;
 	i0 = 0xdead0003;
-	a512 = 0xdead0004;
+	a = 0xdead0004;
 }
 
 static long f456(bool clobber)
@@ -173,8 +173,8 @@ static void checkTLSValues()
 	RTEMS_OBFUSCATE_VARIABLE(addr);
 	rtems_test_assert((addr % 256) == 0);
 	rtems_test_assert(i0 == 0);
-	rtems_test_assert(a512 == 0);
-	addr = reinterpret_cast<uintptr_t>(&a512);
+	rtems_test_assert(a == 0);
+	addr = reinterpret_cast<uintptr_t>(&a);
 	RTEMS_OBFUSCATE_VARIABLE(addr);
 	rtems_test_assert((addr % 512) == 0);
 	rtems_test_assert(f456(false) == 456);
@@ -315,6 +315,8 @@ extern "C" void Init(rtems_task_argument arg)
 #define CONFIGURE_MAXIMUM_POSIX_KEYS 2
 #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 2
 
+#define CONFIGURE_IDLE_TASK_STACK_SIZE (5 * RTEMS_MINIMUM_STACK_SIZE)
+
 #define CONFIGURE_INIT
 
 #include <rtems/confdefs.h>
-- 
2.35.3



More information about the devel mailing list