Re: Mixing egcs and gcc-2.7.2.3 compiled code: struct alignment

Alan Modra (alan@SPRI.Levels.UniSA.Edu.Au)
Wed, 21 Jul 1999 09:35:28 +0930 (CST)


On Tue, 20 Jul 1999, Steve Dodd wrote:

> Does this mean that the compilers are padding struct inode *differently*,
> resulting in u.generic_ip being at different offsets? That's a nightmare :(

I've been bitten by this before. The linux kernel source is at
fault, classic example is in include/asm-i386/spinlock.h

#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
typedef struct { } rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { }
#else
typedef struct { int gcc_is_buggy; } rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
#endif

Any structure incorporating these lock types will thus be differing sizes
depending on your version of gcc. grep the source carefully for "GNUC"

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/