tech-embed archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

arm, net and '__attribute__ ((__packed__))'



Hi,

We're using the network stack and wi driver ported from NetBSD to our
embedded operating system and I'm wondering if there's something wrong with
missing '__attribute__ ((__packed__))'s or something. So, I noticed that
'sizeof(struct llc)' returned 10 (arm-elf-gcc 3.4.2). Then I removed the
comments (and 'XXX' and '???') from 'llc_un'. Which means:

struct llc {
        u_int8_t llc_dsap;
        u_int8_t llc_ssap;
        union {
                .
                .
                .
        } llc_un __attribute__((__packed__));
} __attribute__((__packed__));

This had no effect. Then I swapped 'llc_un' and
'__attribute__((__packed__))' and it worked (sizeof(struct llc) == 8). So:

struct llc {
        u_int8_t llc_dsap;
        u_int8_t llc_ssap;
        union {
                .
                .
                .
        } __attribute__((__packed__)) llc_un;
} __attribute__((__packed__));


I can't believe that NetBSD has any problems with these so maybe I'm missing
some compiler options or has NetBSD's gcc been patched or something else?


Thanks for any help,


       -sk



Home | Main Index | Thread Index | Old Index