This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
ARM structure alignment?
- To: egcs-bugs at cygnus dot com
- Subject: ARM structure alignment?
- From: Dave Gilbert <gilbertd at treblig dot org>
- Date: Sun, 28 Dec 1997 15:34:55 +0000 (GMT)
- cc: richard dot earnshaw at armltd dot co dot uk
Hi,
(EGCS 971215 Host: Alpha (probably irrelevent) Target: ARM -varient ARM3)
In the Linux kernel there is a data structure:
struct ethhdr
{
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
unsigned char h_source[ETH_ALEN]; /* source ether addr */
unsigned short h_proto; /* packet type ID field */
};
(ETH_ALEN=6)
there is a routine in net/ethernet/eth.c eth_type_trans which extracts a
pointer to one of these structures from another structure and then uses
that to read h_proto - thus:
eth->h_proto
Unfortunatly EGCS is presuming that eth is word (4 byte) aligned
which it is not, and using a 'load rotate' (which is alignment
sensitive) to load the short resulting in it reading a few bytes ahead.
Attempts to create the circumstance in a small piece of code have failed.
Dave
---------------------------------------------------- Man can not live -
Dr. David Alan Gilbert - gro.gilbert @ treblig.org by bread alone. He-
---------------------------------------------------- needs chocolate. -