This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [COMMITTED PATCH] BZ#18383: Add test case for large alignment in TLS blocks.
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Thu, 7 May 2015 12:59:22 -0700
- Subject: Re: [COMMITTED PATCH] BZ#18383: Add test case for large alignment in TLS blocks.
- Authentication-results: sourceware.org; auth=none
- References: <20150506203535 dot 48EAF2C3B9D at topped-with-meat dot com>
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?
Thanks.
--
H.J.
---
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. */
#if TLS_TCB_AT_TP
- 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;