about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/x86/init-first.c
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2023-02-22 00:19:31 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-02-27 23:22:40 +0100
commitf6cf701efc61c9ad910372bda14b9a235db310a8 (patch)
treeade1b36ea477b0ee3c9294045a52c34d18d7d2a4 /sysdeps/mach/hurd/x86/init-first.c
parentaf0a16a86345ca1f26e956ef44e4b7240bf705cd (diff)
downloadglibc-f6cf701efc61c9ad910372bda14b9a235db310a8.tar.gz
glibc-f6cf701efc61c9ad910372bda14b9a235db310a8.tar.xz
glibc-f6cf701efc61c9ad910372bda14b9a235db310a8.zip
hurd: Implement TLS for x86_64
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230221211932.296459-4-bugaevc@gmail.com>
Diffstat (limited to 'sysdeps/mach/hurd/x86/init-first.c')
-rw-r--r--sysdeps/mach/hurd/x86/init-first.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sysdeps/mach/hurd/x86/init-first.c b/sysdeps/mach/hurd/x86/init-first.c
index 2fccaefdd2..75a5c842a9 100644
--- a/sysdeps/mach/hurd/x86/init-first.c
+++ b/sysdeps/mach/hurd/x86/init-first.c
@@ -42,8 +42,14 @@ extern char **__libc_argv attribute_hidden;
 extern char **_dl_argv;
 
 #ifndef SHARED
-unsigned short __init1_desc;
 static tcbhead_t __init1_tcbhead;
+# ifndef __x86_64__
+unsigned short __init1_desc;
+# endif
+#endif
+
+#ifdef __x86_64__
+unsigned char __libc_tls_initialized;
 #endif
 
 /* Things that want to be run before _hurd_init or much anything else.
@@ -161,7 +167,13 @@ first_init (void)
   /* In the static case, we need to set up TLS early so that the stack
      protection guard can be read at gs:0x14 by the gcc-generated snippets.  */
   _hurd_tls_init (&__init1_tcbhead);
+
+  /* Make sure __LIBC_NO_TLS () keeps evaluating to 1.  */
+# ifdef __x86_64__
+  __libc_tls_initialized = 0;
+# else
   asm ("movw %%gs,%w0" : "=m" (__init1_desc));
+# endif
 #endif
 
   RUN_RELHOOK (_hurd_preinit_hook, ());