diff mbox

[COMMITTED] BZ#18383: Add test case for large alignment in TLS blocks.

Message ID CAMe9rOqryFresZrjXDwTnNBVseWh6YfgMAN5+niO4oJhA2-RoA@mail.gmail.com
State Committed
Headers show

Commit Message

H.J. Lu May 7, 2015, 7:59 p.m. UTC
On Wed, May 6, 2015 at 1:35 PM, Roland McGrath <roland@hack.frob.com> wrote:
> I just filed this bug and committed this test case for it.  I've marked
> both flavors of the test as XFAIL.  On ARM, both flavors fail (wrong
> alignment).  On x86-64 the dynamically-linked test works right but the
> statically-linked test crashes in startup.  I suspect other machines are
> affected as well and that the bug is not actually machine-dependent.
> I will probably try to look into this next week, but it would be lovely
> if someone else wants to take a crack at it first.

It is a typo.  I am testing the following patch on ia32, x86-64 and x32
which define TLS_TCB_AT_TP.

Can someone please test it on aarch64, arm and powerpc, which
define TLS_DTV_AT_TP?



Roland McGrath May 7, 2015, 8:15 p.m. UTC | #1
Note that your change only affects static linking, while the bug on ARM
affects dynamic linking as well.

On arm-linux-gnueabihf (test runs under qemu), your change did not fix
tst-tlsalign-static and it caused these regressions:

+FAIL: elf/ifuncmain1picstatic
+FAIL: elf/ifuncmain1static
+FAIL: elf/ifuncmain2picstatic
+FAIL: elf/ifuncmain2static
+FAIL: elf/ifuncmain4picstatic
+FAIL: elf/ifuncmain4static
+FAIL: elf/ifuncmain5picstatic
+FAIL: elf/ifuncmain5static
+FAIL: elf/ifuncmain7picstatic
+FAIL: elf/ifuncmain7static
+FAIL: elf/tst-array1-static
+FAIL: elf/tst-array1-static-cmp
+FAIL: elf/tst-array5-static
+FAIL: elf/tst-array5-static-cmp
+FAIL: elf/tst-dl-iter-static
+FAIL: elf/tst-leaks1-static
+FAIL: elf/tst-tls1-static
+FAIL: elf/tst-tls2-static
+FAIL: elf/tst-tls9-static
diff mbox


diff --git a/csu/libc-tls.c b/csu/libc-tls.c
index 64d1779..d797ef4 100644
--- a/csu/libc-tls.c
+++ b/csu/libc-tls.c
@@ -138,10 +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.  */
-  tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
+  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);
+  tcb_offset = roundup (tcbsize, max_align ?: 1);
   tlsblock = __sbrk (tcb_offset + memsz + max_align
 		     + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
   tlsblock += TLS_PRE_TCB_SIZE;