[parisc-linux] compiling kernels with gcc-3.1

Randolph Chung Randolph Chung <randolph@tausq.org>
Fri, 12 Jul 2002 00:36:28 -0700


I seem to recall some reports that you cannot build a working kernel
with gcc-3.1....

Well, maybe they've changed things upstream, but I just tried with
gcc-3.1.1 (3.1.1 20020708 snapshot) and it seems to work well, at least
with my limited testing... this is with the debian default 64-bit smp
.config.

I did have to hack up a bunch of code... it seems like gcc-3.1.1 doesn't
like this construct:

typedef struct {
        volatile unsigned int __attribute__((aligned(16))) lock;
} spinlock_t;

typedef struct {
        spinlock_t lock;
        volatile unsigned int count;
} rwlock_t;

rwlock_t foo = (rwlock_t) { (spinlock_t) { 1 }, 0 };

it complains that the initializer is not constant in this case. 
removing the (rwlock_t) cast fixed that....

also it doesn't like it when you have a variable and you initialize it
after declaration with the { (spinlock_t) { 1 }, 0 } stuff...

(e.g. 
rwlock_t foo;

foo = { (spinlock_t) { 1 }, 0 };

gives a "parse error at {" message)

after working through these problems i got a working kernel...

randolph
--  
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/