From patchwork Wed Jun 24 23:31:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 7340 Received: (qmail 109276 invoked by alias); 24 Jun 2015 23:31:55 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 109261 invoked by uid 89); 24 Jun 2015 23:31:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f171.google.com MIME-Version: 1.0 X-Received: by 10.202.62.212 with SMTP id l203mr34597894oia.67.1435188711339; Wed, 24 Jun 2015 16:31:51 -0700 (PDT) In-Reply-To: <20150609233417.A5E4B2C3B30@topped-with-meat.com> References: <20150506203535.48EAF2C3B9D@topped-with-meat.com> <20150507201552.BD89F2C3BA8@topped-with-meat.com> <20150507211000.B2B932C3B91@topped-with-meat.com> <20150609233417.A5E4B2C3B30@topped-with-meat.com> Date: Wed, 24 Jun 2015 16:31:51 -0700 Message-ID: Subject: Re: [COMMITTED PATCH] BZ#18383: Add test case for large alignment in TLS blocks. From: "H.J. Lu" To: Roland McGrath Cc: "GNU C. Library" On Tue, Jun 9, 2015 at 4:34 PM, Roland McGrath wrote: >> [BZ #18383] >> * csu/libc-tls.c (__libc_setup_tls): Align TCB offset to the >> maximum alignment for TLS_TCB_AT_TP targets. > > * csu/libc-tls.c (__libc_setup_tls) [TLS_TCB_AT_TP]: > Align TCB_OFFSET to MAX_ALIGN, not just TCBALIGN. Add comment. > >> @@ -138,7 +138,9 @@ __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, similar to what >> + _dl_allocate_tls_storage in elf/dl-tls.c does. */ >> + tcb_offset = roundup (memsz + GL(dl_tls_static_size), max_align); > > This would be yet more clear if it said: > > /* 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. */ > > The patch should also remove the XFAIL for tst-align-extern-static > and update the comment on the XFAILs for tst-tlsalign{,-static} > not to say that x86 is broken. > > OK with those details. This is what I checked in. From a7fcc2f8edb26e4d54b6a740aaa3f3bb0caebd14 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 7 May 2015 13:26:34 -0700 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ csu/libc-tls.c | 5 ++++- elf/Makefile | 5 +---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97fbe48..eb44829 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2015-06-24 H.J. Lu + + [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. + 2015-06-24 Joseph Myers * math/test-double.h: New file. diff --git a/csu/libc-tls.c b/csu/libc-tls.c index 64d1779..3f13425 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); diff --git a/elf/Makefile b/elf/Makefile index 871cb4f..4ea3ccf 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -523,16 +523,13 @@ $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so -# BZ#18383: broken on at least ARM (both) and i386/x86-64 (static only). +# BZ#18383: broken on at least ARM (both). test-xfail-tst-tlsalign = yes test-xfail-tst-tlsalign-static = yes $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o -# BZ#18383: broken on at least i386/x86-64 (static only). -test-xfail-tst-tlsalign-extern-static = yes - tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out LDFLAGS-nodel2mod3.so = $(no-as-needed) LDFLAGS-reldepmod5.so = $(no-as-needed) -- 1.9.3