This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more infromation.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
> For the arm platform, I had to do this: > > struct ether_header{ > u_int8_t ether_dhost[ETHER_ADDR_LEN]; > u_int8_t ether_shost[ETHER_ADDR_LEN]; > u_int16_t ether_type; > } __attribute__ ((packed)); > > Is this a arm compiler (armv4l-unknown-linux-gnu) bug? Structure alignment rules vary with target processor, and are set by the target macros in gcc/config/<target>/<target>.h. In general, structures which will be passed between architectures have to be "__attribute__ ((packed))" to get the same results everywhere. You can also have problems within structures if the fields are not "naturally" aligned, i.e. 2-byte fields on even offsets, 4-byte fields on n/4 byte offsets, etc. You should also keep in mind big-endian vs. little-endian issues. Regards, David Querbach Real-Time Systems Inc. ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |