Bug#432861: Compiles arch/x86_64/kernel/signal.c from Linux 2.6.22 incorrectly
Package: gcc-4.2
Version: 4.2-20070707-1
Severity: important
When I build the kernel (either 2.6.21 or 2.6.22) with gcc 4.2-20070707-1,
then try to boot, I get a hang in udevsettle. If I build with gcc
4.2-20070627-1, everything is fine.
The file which matters is arch/x86_64/kernel/signal.c. The gcc version used
to compile this file determines whether the bug triggers or not, independent
of the version used to compile the rest of the kernel.
The command used to compile this file is:
gcc -Wp,-MD,arch/x86_64/kernel/.signal.s.d -nostdinc -isystem
/usr/lib/gcc/x86_64-linux-gnu/4.2.1/include -D__KERNEL__ -Iinclude -include
include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -Os -march=k8 -m64 -mno-red-zone
-mcmodel=kernel -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables
-funit-at-a-time -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
-maccumulate-outgoing-args -fstack-protector -fomit-frame-pointer
-fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign
-D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(signal)"
-D"KBUILD_MODNAME=KBUILD_STR(signal)" -fverbose-asm -S -o
arch/x86_64/kernel/signal.s arch/x86_64/kernel/signal.c
Note that I am using -Os but replacing this with -O2 still causes the bug.
-O1 and -O0 appear to work correctly.
The assembly which 4.2-20070707 with -Os produces for this file includes the
following clearly silly code:
orl %ecx, %esi # __pu_err, __pu_err
orl %edx, %esi # __pu_err, __pu_err
orl %ecx, %esi # __pu_err, __pu_err
orl %eax, %esi # __pu_err, __pu_err
orl %ecx, %esi # __pu_err, __pu_err
orl %ecx, %esi # __pu_err, __pu_err
orl %ecx, %esi # __pu_err, __pu_err
This is only the error handling, and appears to be something of a red
herring, because -O1 gives a similar silly piece of code but the kernel
still works.
The assembly files produced by different compiler versions and optimisations
are at http://www.srcf.ucam.org/~mpo25/2007/linux-signal/
For more, see http://thread.gmane.org/gmane.linux.kernel/551982/focus=553590
--- System information. ---
Architecture: amd64
Kernel: Linux 2.6.21
Debian Release: lenny/sid
990 unstable www.debian-multimedia.org
990 unstable ftp.ie.debian.org
990 unstable ftp-uxsup.csx.cam.ac.uk
500 testing ftp.ie.debian.org
500 testing ftp-uxsup.csx.cam.ac.uk
1 experimental ftp.ie.debian.org
1 experimental ftp-uxsup.csx.cam.ac.uk
--- Package information. ---
Depends (Version) | Installed
======================================-+-======================
gcc-4.2-base (= 4.2-20070707-1) | 4.2-20070707-1
cpp-4.2 (= 4.2-20070707-1) | 4.2-20070707-1
binutils (>= 2.17cvs20070426) | 2.17.20070406cvs-2
libgcc1 (>= 1:4.2-20070707-1) | 1:4.2-20070707-1
libgomp1 (>= 4.2-20070707-1) | 4.2-20070707-1
libc6 (>= 2.5-5) | 2.6-2
--
Martin Orr
Reply to: