pragma packing on sparc solaris

Geoff Thorpe geoff at geoffthorpe.net
Thu Oct 17 12:09:29 CDT 2002


Hi there,

On Thursday 17 Oct 2002 4:37 am, Juraj Hercek wrote:
> Hi,
>> I'm trying to get wine working on solaris running on sparc. I have
> troubles with structure packing, since sparc solaris throws SIGSEGV
> when writting to structure members not aligned to 4-byte boundary
> (for example: loader/ne/resource.c:280, where &pTypeInfo->resloader
> is not aligned to 4-byte boundary).

SIGSEGV? Heh, that makes a pleasant change - I've sent plenty of 
alignment problems when taking ix86-acceptable code to sparc, mips, 
etc, but they usually throw a SIGBUS instead. Anyway ...

> Since I'm new to wine, I'd like to know about packing policies
> (pragma pack 1,2,...) in wine:
> 1) When do we use packing and why (optimisation?)?

AFAICS, to make structures binary compatible between MSVC/Win32-native 
code and gcc/wine code - MSVC (on x86 anyway) packs structures without  
caring too much about word-alignment.

> 2) What would happen if pragma packing is ommited or always set to 4?

Well, if you're on sparc then you're probably not caring much about 
binary compatibility between wine code and native windows? In fact, is 
there (or was there ever) such a thing as "native windows" on sparc? 
Assuming there is, and *you* care about binary compatibility with it - 
can you see what MSVC does to structures on sparc? I'm assuming that 
even windoze/MSVC would respect alignments on (supported) platforms if 
failing to do so would SIGBUS all the time. Then again, this is 
Microsoft we're talking about ... as long as you can catch the 
exception and throw up a blue-screen it's OK ...

Cheers,
Geoff

-- 
Geoff Thorpe
geoff at geoffthorpe.net
http://www.geoffthorpe.net/




More information about the wine-devel mailing list