aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2018-06-12 15:35:22 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2018-06-12 08:35:22 -0700
commita25eadc86739fe3f4f0a35dfe6e5047978e2d2e5 (patch)
treeb00e320ed0875fb92cb060daa1d603a5adadef5f /gcc
parent764d9a51e65865ad531e70abf1fff4926b591746 (diff)
downloadgcc-a25eadc86739fe3f4f0a35dfe6e5047978e2d2e5.zip
gcc-a25eadc86739fe3f4f0a35dfe6e5047978e2d2e5.tar.gz
gcc-a25eadc86739fe3f4f0a35dfe6e5047978e2d2e5.tar.bz2
Linux/x86: Update TARGET_THREAD_SPLIT_STACK_OFFSET comments
Glibc 2.18 was changed by commit ecbf434213c0333d81706074e4d107ac45011635 Author: Andreas Jaeger <aj@suse.de> Date: Wed May 15 20:20:54 2013 +0200 Reserve new TLS field for x86 and x86_64 [BZ #10686] * sysdeps/x86_64/tls.h (struct tcbhead_t): Add __private_ss field. * sysdeps/i386/tls.h (struct tcbhead_t): Likewise. to reduce the size of __private_tm to make room for __private_ss, which was supposed to be used for TARGET_THREAD_SPLIT_STACK_OFFSET: 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; But the offset of __private_ss for i386 was mistakenly set to 0x30, instead of 0x34 and libgcc/config/i386/morestack.S has: cmpl %gs:0x30,%eax # See if we have enough space. movl %eax,%gs:0x30 # Save the new stack boundary. movl %eax,%gs:0x30 # Save the new stack boundary. movl %ecx,%gs:0x30 # Save new stack boundary. movl %eax,%gs:0x30 movl %gs:0x30,%eax movl %eax,%gs:0x30 Since update TARGET_THREAD_SPLIT_STACK_OFFSET changes split stack ABI, glibc 2.28 has been changed by commit 0221ce2a90be2d40fc90f0b5dcec77a1ec013f53 Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Jun 12 06:23:28 2018 -0700 i386: Change offset of __private_ss to 0x30 [BZ #23250] to match GCC: 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[3]; /* GCC split stack support. */ void *__private_ss; void *__glibc_reserved2; } tcbhead_t; PR target/85990 * config/i386/gnu-user.h (TARGET_THREAD_SPLIT_STACK_OFFSET): Update comments. * config/i386/gnu-user64.h (TARGET_THREAD_SPLIT_STACK_OFFSET): Likewise. From-SVN: r261501
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/gnu-user.h2
-rw-r--r--gcc/config/i386/gnu-user64.h4
3 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 610abcd..0170e1e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/85990
+ * config/i386/gnu-user.h (TARGET_THREAD_SPLIT_STACK_OFFSET):
+ Update comments.
+ * config/i386/gnu-user64.h (TARGET_THREAD_SPLIT_STACK_OFFSET):
+ Likewise.
+
2018-06-12 Martin Liska <mliska@suse.cz>
* doc/options.texi: Document IntegerRange.
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index d1dad68..56449a5 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. */
+/* i386 glibc provides __private_ss in %gs:0x30. */
#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
#endif
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index 491416f..f7a68fd 100644
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -86,7 +86,9 @@ 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:0x30.
+ 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)
#endif