]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86: Fix THREAD_GSCOPE_RESET_FLAG build on clang
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 31 Oct 2025 20:00:47 +0000 (17:00 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 10 Nov 2025 11:58:10 +0000 (08:58 -0300)
clang does not support __seg_fs in asm constraint.

Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
sysdeps/x86_64/nptl/tls.h

index abfeb8805453965753d75b3aa9319a9d5f385ac3..9d53f05e65ce37ea37f514965ee35daea714230d 100644 (file)
@@ -198,10 +198,18 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
 # define THREAD_GSCOPE_FLAG_UNUSED 0
 # define THREAD_GSCOPE_FLAG_USED   1
 # define THREAD_GSCOPE_FLAG_WAIT   2
+
+/* clang does not support __seg_fs in asm constraint.  */
+# ifdef __clang__
+#  define FS_ASM "%%fs:"
+# else
+#  define FS_ASM
+# endif
+
 # define THREAD_GSCOPE_RESET_FLAG() \
   do                                                                         \
     { int __res;                                                             \
-      asm volatile ("xchgl %1, %0"                                           \
+      asm volatile ("xchgl " FS_ASM "%1, %0"                                 \
                    : "=r" (__res)                                            \
                    : "m" (((struct pthread __seg_fs *)0)->header.gscope_flag), \
                      "0" (THREAD_GSCOPE_FLAG_UNUSED));                       \