https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85990
Bug ID: 85990 Summary: Wrong TARGET_THREAD_SPLIT_STACK_OFFSET Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: ubizjak at gmail dot com Target Milestone: --- Target: i*86-pc-linux-gnu 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; and sysdeps/x86_64/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; int gscope_flag; uintptr_t sysinfo; uintptr_t stack_guard; uintptr_t pointer_guard; unsigned long int vgetcpu_cache[2]; int __glibc_reserved1; int __glibc_unused1; /* Reservation of some values for the TM ABI. */ void *__private_tm[4]; /* GCC split stack support. */ void *__private_ss; long int __glibc_reserved2; /* Must be kept even if it is no longer used by glibc since programs, like AddressSanitizer, depend on the size of tcbhead_t. */ __128bits __glibc_unused2[8][4] __attribute__ ((aligned (32))); void *__padding[8]; } tcbhead_t; The offsets of __private_tm are i386: 36 bytes x32: 48 bytes x86_64: 80 bytes gcc/config/i386/gnu-user64.h has /* We steal the last transactional memory word. */ #define TARGET_THREAD_SPLIT_STACK_OFFSET \ (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30) Should't it be (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x34)