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

Artur Skawina (skawina@geocities.com)
Wed, 21 Jul 1999 02:42:48 +0200


Steve Dodd wrote:
>
> Okay, this one had me scratching my head for a good hour. I've got this
> function:

> movl 176(%edi),%eax << >> movl 188(%edi),%eax

> The differing line is obviously the equivalent of the NTFS_I macro.
> Now, my kernel was compiled with 2.7.2.3, and the module compiled with
> 2.7.2.3 works. The one compiled with egcs doesn't.
>
> Does this mean that the compilers are padding struct inode *differently*,
> resulting in u.generic_ip being at different offsets? That's a nightmare :(

hmm, struct inode constains "wait_queue_head_t i_wait",
wait_queue_head_t constains "wq_lock_t lock",
wq_lock_t is defined as spinlock_t,
and spinlock_t is defined like this:

linux/include/asm-i386/spinlock.h:
>/*
> * Your basic spinlocks, allowing only a single CPU anywhere
> *
> * Gcc-2.7.x has a nasty bug with empty initializers.
> */
>#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
> typedef struct { } spinlock_t;
> #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
>#else
> typedef struct { int gcc_is_buggy; } spinlock_t;
> #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
>#endif

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