From 73258ec458aa88a8d3cfb4ecf15275569a6f68e9 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 26 Jan 2018 22:35:29 +0000 Subject: [PATCH] Fix tls support for glibc 2.25 * csu/libc-start.c (LIBC_START_MAIN) [__GNU__]: Do not call __libc_setup_tls. * sysdeps/mach/hurd/i386/init-first.c (init): Call __libc_setup_tls. Signed-off-by: Samuel Thibault Gbp-Pq: Topic hurd-i386 Gbp-Pq: Name tg2.25-tls.diff --- csu/libc-start.c | 2 ++ sysdeps/mach/hurd/i386/init-first.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/csu/libc-start.c b/csu/libc-start.c index 672061718..561c63df0 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -193,8 +193,10 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), /* Perform IREL{,A} relocations. */ ARCH_SETUP_IREL (); +#ifndef __GNU__ /* The stack guard goes into the TCB, so initialize it early. */ __libc_setup_tls (); +#endif /* In some architectures, IREL{,A} relocations happen after TLS setup in order to let IFUNC resolvers benefit from TCB information, e.g. powerpc's diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c index 8753b543f..01299af70 100644 --- a/sysdeps/mach/hurd/i386/init-first.c +++ b/sysdeps/mach/hurd/i386/init-first.c @@ -189,7 +189,8 @@ init (int *data) assert (d->phdrsz % sizeof (ElfW(Phdr)) == 0); } - /* We need to setup TLS before starting sigthread */ + /* We need to setup TLS before starting sigthread and set stack guard. */ + __libc_setup_tls (); extern void __pthread_initialize_minimal(void); if (__pthread_initialize_minimal != NULL) __pthread_initialize_minimal(); -- 2.30.2