summaryrefslogtreecommitdiff
path: root/sysdeps/x86_64
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-10-31 17:00:47 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-11-10 08:58:10 -0300
commite3394859eeee302edff09eb8ed0ec575aa8c5614 (patch)
tree8e8ecc20aae6904c06db22b2edddb921daf6523a /sysdeps/x86_64
parent427c25278d1dae62dffa07ea5cd0fc33f07190af (diff)
x86: Fix THREAD_GSCOPE_RESET_FLAG build on clang
clang does not support __seg_fs in asm constraint. Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/nptl/tls.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h
index abfeb88054..9d53f05e65 100644
--- a/sysdeps/x86_64/nptl/tls.h
+++ b/sysdeps/x86_64/nptl/tls.h
@@ -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)); \