Subject: Re: ancillary data alignment and binary backward compatibility
To: Jun-ichiro itojun Hagino <itojun@iijlab.net>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-net
Date: 03/07/2000 23:16:50
Jun-ichiro itojun Hagino <itojun@iijlab.net> writes:
> >Why is this a good thing to have a sysctl for?
> >* it's not gonna change on a given MACHINE_ARCH.  (if it does, well,
> >something _else_ is seriously wrong.)
> >* it's easier, nicer, faster code is produced if you do 
> >masks/shifts/ands etc. with constants known at compile time than if
> >you do them all as needed at run-time with variables.
> 
> 	ALIGNBYTES can be different between the kernel and the userland,
> 	if you run sparc32 binary on sparc64 kernel.
> 	http://mail-index.netbsd.org/tech-net/2000/02/28/0012.html
> 	(and bunch of emails near this one)

I read that bit.  That's not a justification.

For binaries of MACHINE_ARCH sparc (i.e. sparc32 binaries), ALIGNBYTES
(and friends) have a particular definition.

Emulation of the binaries for that different MACHINE_ARCH (and yes, it
is emulation, just as linux emulation on x86 is emulation; it's a
different ABI) must respect that definition, to be correct.

The compiler, for instance, isn't gonna start using a larger structure
alignment for random structures compiled for sparc32 when run on
sparc64 -- it doesn't, can't, and shouldn't know about what the kernel
thinks the alignment "should be."



cgd
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.