diff mbox

[AARCH64] correct alignment of TLS_TCB_ALIGN

Message ID 20140512174746.GE21081@redacted.bos.redhat.com
State New
Headers show

Commit Message

Kyle McMartin May 12, 2014, 5:47 p.m. UTC
This fixes a variety of testsuite failures for me:
tststatic.out Error 1
tststatic2.out Error 1
tst-tls9-static.out Error 1
tst-audit8.out Error 127
tst-audit9.out Error 127
tst-audit1.out Error 127
and also has the added benefit of making LD_AUDIT/sotruss work on
AArch64.

Otherwise, we bail out early in _dl_try_allocate_static_tls as the
alignment requirement of the PT_TLS section in libc is 16.

2014-05-12  Kyle McMartin  <kyle@redhat.com>

  * sysdeps/aarch64/nptl/tls.h: increase TCB alignment to the alignment
    of struct pthread.

Comments

Andrew Pinski May 12, 2014, 6:27 p.m. UTC | #1
On Mon, May 12, 2014 at 10:47 AM, Kyle McMartin <kmcmarti@redhat.com> wrote:
> This fixes a variety of testsuite failures for me:
> tststatic.out Error 1
> tststatic2.out Error 1
> tst-tls9-static.out Error 1
> tst-audit8.out Error 127
> tst-audit9.out Error 127
> tst-audit1.out Error 127
> and also has the added benefit of making LD_AUDIT/sotruss work on
> AArch64.
>
> Otherwise, we bail out early in _dl_try_allocate_static_tls as the
> alignment requirement of the PT_TLS section in libc is 16.


This is already https://sourceware.org/bugzilla/show_bug.cgi?id=16796 .

It is also the same patch which I had came up when I was working on
ILP32 changes.

Thanks,
Andrew

>
> 2014-05-12  Kyle McMartin  <kyle@redhat.com>
>
>   * sysdeps/aarch64/nptl/tls.h: increase TCB alignment to the alignment
>     of struct pthread.
>
> --- a/sysdeps/aarch64/nptl/tls.h
> +++ b/sysdeps/aarch64/nptl/tls.h
> @@ -63,7 +63,7 @@ typedef struct
>  # define TLS_INIT_TCB_SIZE     sizeof (tcbhead_t)
>
>  /* Alignment requirements for the initial TCB.  */
> -# define TLS_INIT_TCB_ALIGN    __alignof__ (tcbhead_t)
> +# define TLS_INIT_TCB_ALIGN    __alignof__ (struct pthread)
>
>  /* This is the size of the TCB.  */
>  # define TLS_TCB_SIZE          sizeof (tcbhead_t)
> @@ -72,7 +72,7 @@ typedef struct
>  # define TLS_PRE_TCB_SIZE      sizeof (struct pthread)
>
>  /* Alignment requirements for the TCB.  */
> -# define TLS_TCB_ALIGN         __alignof__ (tcbhead_t)
> +# define TLS_TCB_ALIGN         __alignof__ (struct pthread)
>
>  /* Install the dtv pointer.  The pointer passed is to the element with
>     index -1 which contain the length.  */
Kyle McMartin May 12, 2014, 6:27 p.m. UTC | #2
On Mon, May 12, 2014 at 11:27:03AM -0700, Andrew Pinski wrote:
> On Mon, May 12, 2014 at 10:47 AM, Kyle McMartin <kmcmarti@redhat.com> wrote:
> > This fixes a variety of testsuite failures for me:
> > tststatic.out Error 1
> > tststatic2.out Error 1
> > tst-tls9-static.out Error 1
> > tst-audit8.out Error 127
> > tst-audit9.out Error 127
> > tst-audit1.out Error 127
> > and also has the added benefit of making LD_AUDIT/sotruss work on
> > AArch64.
> >
> > Otherwise, we bail out early in _dl_try_allocate_static_tls as the
> > alignment requirement of the PT_TLS section in libc is 16.
> 
> 
> This is already https://sourceware.org/bugzilla/show_bug.cgi?id=16796 .
> 
> It is also the same patch which I had came up when I was working on
> ILP32 changes.
> 

Sigh. That'd have been nice to have been submitted a month ago. What
gives?

--Kyle
Marcus Shawcroft May 19, 2014, 11:23 a.m. UTC | #3
On 12 May 2014 18:47, Kyle McMartin <kmcmarti@redhat.com> wrote:

> 2014-05-12  Kyle McMartin  <kyle@redhat.com>
>
>   * sysdeps/aarch64/nptl/tls.h: increase TCB alignment to the alignment
>     of struct pthread.


Thanks Kyle, this looks fine, go ahead and commit it, can you back port it?

/Marcus
Siddhesh Poyarekar May 26, 2014, 7:33 a.m. UTC | #4
On Mon, May 19, 2014 at 12:23:18PM +0100, Marcus Shawcroft wrote:
> On 12 May 2014 18:47, Kyle McMartin <kmcmarti@redhat.com> wrote:
> 
> > 2014-05-12  Kyle McMartin  <kyle@redhat.com>
> >
> >   * sysdeps/aarch64/nptl/tls.h: increase TCB alignment to the alignment
> >     of struct pthread.
> 
> 
> Thanks Kyle, this looks fine, go ahead and commit it, can you back port it?

I have pushed this for Kyle.

Siddhesh
Kyle McMartin May 27, 2014, 4:30 p.m. UTC | #5
On Mon, May 26, 2014 at 01:03:03PM +0530, Siddhesh Poyarekar wrote:
> On Mon, May 19, 2014 at 12:23:18PM +0100, Marcus Shawcroft wrote:
> > On 12 May 2014 18:47, Kyle McMartin <kmcmarti@redhat.com> wrote:
> > 
> > > 2014-05-12  Kyle McMartin  <kyle@redhat.com>
> > >
> > >   * sysdeps/aarch64/nptl/tls.h: increase TCB alignment to the alignment
> > >     of struct pthread.
> > 
> > 
> > Thanks Kyle, this looks fine, go ahead and commit it, can you back port it?
> 
> I have pushed this for Kyle.
> 

Ah, foo, I was hoping Andrew Pinski would commit it himself, since he
ended up coming up with the fix first on BZ. :/

Sorry Andrew.

regards, Kyle
diff mbox

Patch

--- a/sysdeps/aarch64/nptl/tls.h
+++ b/sysdeps/aarch64/nptl/tls.h
@@ -63,7 +63,7 @@  typedef struct
 # define TLS_INIT_TCB_SIZE	sizeof (tcbhead_t)
 
 /* Alignment requirements for the initial TCB.  */
-# define TLS_INIT_TCB_ALIGN	__alignof__ (tcbhead_t)
+# define TLS_INIT_TCB_ALIGN	__alignof__ (struct pthread)
 
 /* This is the size of the TCB.  */
 # define TLS_TCB_SIZE		sizeof (tcbhead_t)
@@ -72,7 +72,7 @@  typedef struct
 # define TLS_PRE_TCB_SIZE	sizeof (struct pthread)
 
 /* Alignment requirements for the TCB.  */
-# define TLS_TCB_ALIGN		__alignof__ (tcbhead_t)
+# define TLS_TCB_ALIGN		__alignof__ (struct pthread)
 
 /* Install the dtv pointer.  The pointer passed is to the element with
    index -1 which contain the length.  */