winebuild ppc

Ulrich Weigand weigand at immd1.informatik.uni-erlangen.de
Mon Feb 12 19:14:32 CST 2001


Josh DuBois wrote:

>        Well, on the ppc it seems that CRITICAL_SECTIONS which are initialized (they
> get set to CRITICAL_SECTION_INIT a lot) fairly reliably get put on 2-byte
> boundaries.  I am not certain why this is the case.  

But this is the real question ;-)  As I said, the *default* alignment of these
structs is 4 byte.  If they are in fact placed at 2-byte boundaries, I can see
only a few possible explanations:
  - compiler bug
  - some weird interaction with Wine that causes the compiler to misbehave
  - *another* explicit alignment attribute somewhere

The first two I consider rather unlikely (but certainly possible).
The last point is the IMO most likely, however.  Maybe there's a 
#pragma pack(1) section somewhere that isn't properly terminated
or something similar.

> I could perhaps try to change
> all the instances of initialized critial sections to have their data copied into
> them during an init routine, but that seems like yet another big weirdness.  Or
> maybe I can convince the compiler to stop aligning them strangely in the first
> place.

It should by default :-/
 
>       The problem is that the instructions to implement Interlocked* functions on
> the ppc require the destination of a store to be 4-byte aligned (so I want to align
> the LockCount member).  

Sure.

> I'm not sure, actually, how to be certain that regular
> int's passed to these functions will be aligned, but I havn't seen problems (yet)
> other than with the funny alignment of the CRITICAL_SECTION structs.

Every 'int' is supposed to be 4-byte aligned, unless you override by
some explicit alignment/packing statement.

Bye,
Ulrich




More information about the wine-devel mailing list