summary refs log tree commit diff
path: root/csu
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-05-07 13:26:34 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-06-24 16:30:58 -0700
commita7fcc2f8edb26e4d54b6a740aaa3f3bb0caebd14 (patch)
tree93de3ec2350c8af7ccc5927071f38382be139de2 /csu
parentf9536db79065ad00efd877b4d80a1dd06938bd0a (diff)
downloadglibc-a7fcc2f8edb26e4d54b6a740aaa3f3bb0caebd14.tar.gz
glibc-a7fcc2f8edb26e4d54b6a740aaa3f3bb0caebd14.tar.xz
glibc-a7fcc2f8edb26e4d54b6a740aaa3f3bb0caebd14.zip
Align TCB offset to the maximum alignment
We need to align TCB offset to the maximum alignment for TLS_TCB_AT_TP
targets, as _dl_allocate_tls_storage (in elf/dl-tls.c) does using
__libc_memalign and dl_tls_static_align.

	[BZ #18383]
	* csu/libc-tls.c (__libc_setup_tls) [TLS_TCB_AT_TP]: Align
	TCB_OFFSET to MAX_ALIGN, not just TCBALIGN.  Add comment.
	* elf/Makefile (test-xfail-tst-tlsalign{,-static}): Remove
	comment for i386/x86-64.
	(test-xfail-tst-tlsalign-extern-static): Removed.
Diffstat (limited to 'csu')
-rw-r--r--csu/libc-tls.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/csu/libc-tls.c b/csu/libc-tls.c
index 64d177955f..3f134252a3 100644
--- a/csu/libc-tls.c
+++ b/csu/libc-tls.c
@@ -138,7 +138,10 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
      to request some surplus that permits dynamic loading of modules with
      IE-model TLS.  */
 #if TLS_TCB_AT_TP
-  tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
+  /* Align the TCB offset to the maximum alignment, as
+     _dl_allocate_tls_storage (in elf/dl-tls.c) does using __libc_memalign
+     and dl_tls_static_align.  */
+  tcb_offset = roundup (memsz + GL(dl_tls_static_size), max_align);
   tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
 #elif TLS_DTV_AT_TP
   tcb_offset = roundup (tcbsize, align ?: 1);