This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: handle user-defined alignment on SPU

Trevor Smigiel wrote:

> The following test case will fail, with or without this patch.
>   extern void exit (int);
>   extern void abort (void);
>   int a = 1;
>   int b __attribute__ ((__aligned__(4))) = 2;
>   int main()
>   {
>      a = 3;
>      if (b != 2)
>        abort ();
>      exit (0);
>   }
> Can you adjust your patch to make it work?  Perhaps special
> data sections for data with less than 16-byte alignment.
> The SPU backend assumes all objects are aligned to 16 bytes, which means
> that they are also all padded to 16 bytes.  It does this so it can use
> single instruction loads and stores to access scalar objects.

Right.  The patch does fix the problem it was originally implemented
to solve, because the aligned variables in crtstuff.c are in sections
of their own anyway (.ctors / .dtors).

However, to make it more generally useful, I agree that variables
defined with non-standard alignment (but without any specical section
assignment) should by default be moved to another section.  What about
.data.unaligned and .bss.unaligned?

Do you think this should be explicitly specified in the ABI, or would
this simply be an extension?  The ABI currently does not allow for
global data variables with less than 16 bytes alignment at all.


  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]