Greetings,
a glibc compiled with the latest gcc crashes in __libc_start_main.
The cause is that the compiler has decided to extract the tls pointer
in __libc_start_main() from the access registers a0/a1 into a general
register before the tls pointer has been set up by the call to
__pthread_initialize_minimal().
The least invasive fix is to clobber the access registers before the
first use in THREAD_SET_STACK_GUARD(). This makes the compiler to
do the tls pointer extraction after __pthread_initialize_minimal().
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
--
2008-10-06 Martin Schwidefsky <schwidefsky@de.ibm.com>
* sysdeps/s390/tls.h (THREAD_SET_STACK_GUARD): Add empty inline
assembly with a clobber list for access registers a0 and a1.
diff -urpN libc/nptl/sysdeps/s390/tls.h libc-s390/nptl/sysdeps/s390/tls.h
--- libc/nptl/sysdeps/s390/tls.h 2007-08-07 13:09:01.000000000 +0200
+++ libc-s390/nptl/sysdeps/s390/tls.h 2008-10-06 19:55:46.000000000 +0200
@@ -161,7 +161,12 @@ typedef struct
/* Set the stack guard field in TCB head. */
#define THREAD_SET_STACK_GUARD(value) \
- THREAD_SETMEM (THREAD_SELF, header.stack_guard, value)
+ do \
+ { \
+ __asm __volatile ("" : : : "a0", "a1"); \
+ THREAD_SETMEM (THREAD_SELF, header.stack_guard, value); \
+ } \
+ while (0)
#define THREAD_COPY_STACK_GUARD(descr) \
((descr)->header.stack_guard \
= THREAD_GETMEM (THREAD_SELF, header.stack_guard))