Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2006 13:21:05 -0500
From:      Alexander Kabaev <kabaev@gmail.com>
To:        Giorgos Keramidas <keramida@freebsd.org>
Cc:        arm@freebsd.org, current@freebsd.org
Subject:   Re: [head tinderbox] failure on arm/arm
Message-ID:  <20061112132105.6bac38d6@kan.dnsalias.net>
In-Reply-To: <20061112180758.GD4237@kobe.laptop>
References:  <20061112140010.GA47660@rambler-co.ru> <20061112142710.GE91556@wombat.fafoe.narf.at> <20061112133929.9194773068@freebsd-current.sentex.ca> <20061112140010.GA47660@rambler-co.ru> <20061112144230.GC2331@kobe.laptop> <20061112145151.GC49703@rambler-co.ru> <20061112151150.GA2988@kobe.laptop> <20061112155723.GB50349@rambler-co.ru> <20061112165904.GP6501@plum.flirble.org> <20061112171436.GF50349@rambler-co.ru> <20061112180758.GD4237@kobe.laptop>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_CjRMC7u8sQyTRrKNY83VXXE
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Sun, 12 Nov 2006 19:07:58 +0100
Giorgos Keramidas <keramida@freebsd.org> wrote:

> On 2006-11-12 20:14, Ruslan Ermilov <ru@freebsd.org> wrote:
> >On Sun, Nov 12, 2006 at 04:59:04PM +0000, Nicholas Clark wrote:
> >>On Sun, Nov 12, 2006 at 06:57:23PM +0300, Ruslan Ermilov wrote:
> >>> So your sizeof() argument, well...  I don't understand it and it
> >>> doesn't make things clearer at least to me.  I still believe this
> >>> is bug in GCC that the alignment requirement is so high for a
> >>> "struct foo { char x; }" (there's no real reason for this!).
> >>
> >> It is no bug in GCC. ANSI C gives extreme flexibility for the
> >> compiler to align (or pad) structures. The assumptions in the code
> >> you presented are not portable. The problem tends to be that ARM
> >> is the only common platform that does structure alignment this
> >> way, so tends to trip up a lot of code that has worked just fine
> >> in many other places.
> >>
> >> There is a lot more detail in
> >> http://netwinder.osuosl.org/users/b/brianbr/public_html/alignment.html
> >> including how gcc's __packed__ extention can be used to tell gcc
> >> to align structures in different ways.
> >
> > Thanks!  Item 2 at this URL has an answer to my question.
>=20
> Perfect!
>=20
> Now it's obvious why GCC prefers '4-byte accesses' on ARM.
> Nicholas, thank you so much :)
>=20
  GCC expects 4-byte aligned structured on ARM but does not necessarily
have to. We can change the default at the expense of possible more
inefficient code generated and lost binary compatibility with other ARM
OSes out there. So this is trade off between unclear performance
penalty and an unspecified but certainly sizable number of other
landmines like this lurking on the code.

We should decide what evil we regard as lesser.

--=20
Alexander Kabaev

--Sig_CjRMC7u8sQyTRrKNY83VXXE
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFV2YYQ6z1jMm+XZYRAiv6AJwI+6bO6xIP6qnbAnx+V3R4zg0Z/wCgnzGw
THSY8Ry1ncgrGhqV+CoECNY=
=zjot
-----END PGP SIGNATURE-----

--Sig_CjRMC7u8sQyTRrKNY83VXXE--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061112132105.6bac38d6>