This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Add x32 support to tcbhead_t
On Monday 14 of May 2012 11:30:20 H.J. Lu wrote:
> On Mon, May 14, 2012 at 11:15 AM, Roland McGrath <roland@hack.frob.com> wrote:
> >> * sysdeps/x86_64/tls.h: Don't include <bits/wordsize.h>.
> >> Check __x86_64__ instead of __WORDSIZE.
> >> (tcbhead_t): Pad rtld_savespace_sse to 32byte aligned.
> >
> > "32-byte alignment".
>
> I will change it.
>
> >> -# if __WORDSIZE == 64
> >> +# ifdef __x86_64__
> >> int rtld_must_xmm_save;
> >> # endif
> >
> > I don't understand why this had the #if to being with. This is an
> > internal header file and (before now) was only ever used for x86_64.
> > Shouldn't we just remove this conditionalization altogether?
>
> Yes, we can remove it.
>
> >> /* Reservation of some values for the TM ABI. */
> >> void *__private_tm[5];
> >> -# if __WORDSIZE == 64
> >> +# ifdef __x86_64__
> >> +# ifdef __LP64__
> >> long int __unused2;
> >> +# else
> >> + /* Pad rtld_savespace_sse to 32byte aligned. */
> >
> > "32-byte alignment".
>
> I will change it.
>
> >> + void *__padding1[5];
> >> +# endif
> >> /* Have space for the post-AVX register size. */
> >> __m128 rtld_savespace_sse[8][4];
> >
> > Why can't you just use an __attribute__ ((aligned (32))) on the field
> > instead of manual padding?
> >
>
> __attribute__ ((aligned (32))) doesn't work on field of
> a struct. You have to either manually pad it or use
> an aligned type.
aligned(32) works for me (gcc-4.6/4.7/4.8) on struct's field:
typedef struct
{
int i1;
int i2 __attribute__((aligned(32)));
int i3;
} S;
void foo( S* s )
{
s->i1 = 1;
s->i2 = 2;
s->i3 = 3;
}
foo:
movl $1, (%rdi)
movl $2, 32(%rdi)
movl $3, 36(%rdi)
ret