This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RFC: Linux/i386: Set TARGET_THREAD_SPLIT_STACK_OFFSET to 0x34
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Uros Bizjak <ubizjak at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 30 May 2018 05:13:05 -0700
- Subject: RFC: Linux/i386: Set TARGET_THREAD_SPLIT_STACK_OFFSET to 0x34
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
TARGET_THREAD_SPLIT_STACK_OFFSET has been wrong for Linux/i386 from
the start. Should we change glibc for GCC's mistake or fix GCC?
H.J.
---
In glibc, sysdeps/i386/nptl/tls.h has
typedef struct
{
void *tcb; /* Pointer to the TCB. Not necessarily the
thread descriptor used by libpthread. */
dtv_t *dtv;
void *self; /* Pointer to the thread descriptor. */
int multiple_threads;
uintptr_t sysinfo;
uintptr_t stack_guard;
uintptr_t pointer_guard;
int gscope_flag;
int __glibc_reserved1;
/* Reservation of some values for the TM ABI. */
void *__private_tm[4];
/* GCC split stack support. */
void *__private_ss;
} tcbhead_t;
Update i386 TARGET_THREAD_SPLIT_STACK_OFFSET to 0x34 to match the offset
of __private_ss.
PR target/85990
* config/i386/gnu-user.h (TARGET_THREAD_SPLIT_STACK_OFFSET): Set
to 0x34.
* config/i386/gnu-user64.h (TARGET_THREAD_SPLIT_STACK_OFFSET):
Set to 0x34 for -m32.
---
gcc/config/i386/gnu-user.h | 4 ++--
gcc/config/i386/gnu-user64.h | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index d1dad685e72..7d061f392ea 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -134,6 +134,6 @@ along with GCC; see the file COPYING3. If not see
/* i386 glibc provides __stack_chk_guard in %gs:0x14. */
#define TARGET_THREAD_SSP_OFFSET 0x14
-/* We steal the last transactional memory word. */
-#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
+/* i386 glibc provides __private_ss in %gs:0x34. */
+#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x34
#endif
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index 491416fec0c..47d6a3bf34c 100644
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -86,9 +86,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define TARGET_THREAD_SSP_OFFSET \
(TARGET_64BIT ? (TARGET_X32 ? 0x18 : 0x28) : 0x14)
-/* We steal the last transactional memory word. */
+/* i386 glibc provides __private_ss in %gs:0x34,
+ x32 glibc provides it in %fs:0x40.
+ x86_64 glibc provides it in %fs:0x70. */
#define TARGET_THREAD_SPLIT_STACK_OFFSET \
- (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
+ (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x34)
#endif
#undef WCHAR_TYPE
--
2.17.0