SMP and gcc 2.7.2.3 break arch/i386/kernel/time.c (more clues ->

David Dyck (dcd@tc.fluke.com)
Tue, 7 Dec 1999 15:00:59 -0800 (PST)


Someone sent me private email indicating

> any bug-reports for building or running kernels with invalid compilers
> will be ignored.

I didn't think that there were many changes between 2.7.2.1
and 2.7.2.3 (it was documented only to enable support for glibc2)

Anyway I upgraded to gcc version 2.7.2.3
and enabled SMP and attempted to rebuild the kernel again
and got the same error

time.c: In function `do_gettimeofday':
time.c:262: fixed or forbidden register was spilled.
This may be due to a compiler bug or to impossible asm
statements or clauses.

make[1]: Leaving directory `/usr/src/linux-2.3.30/arch/i386/kernel'

in do_gettimeofday() the line
read_lock_irqsave(&xtime_lock, flags);
expands to a call to
read_lock( &xtime_lock );
along with other lines

and in do_settimeofday()
write_lock_irq(&xtime_lock);
expands to a call to
write_lock( &xtime_lock );

when I preprocesed the file with -E
and commented out
read_lock( &xtime_lock );
and
write_lock( &xtime_lock );
in their respective functions I was able to compile
without the above error message.

Looking at read_lock it seems the problem can be narrowed down
to the macro __build_read_lock_ptr()
in include/asm-i386/rwlock.h

#define __build_read_lock_ptr(rw, helper) \
asm volatile(LOCK "subl $1,(%0)\n\t" \
"js 2f\n" \
"1:\n" \
".section .text.lock,\"ax\"\n" \
"2:\tcall " helper "\n\t" \
"jmp 1b\n" \
".previous" \
::"a" (rw) : "memory")

This is about as far as I can go with extended asm,
although I'd love to learn a bit more.
does &xtime_lock need to be in eax

what does .previous mean (info gas doesn't describe it)
I assume it has something to do with restoring
the .section pseudo-op, but where is this documented

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