This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

ARM structure alignment?


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.  -



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]