Bug 183301 - GCC 4.1 and SPCA5XX don't work together
GCC 4.1 and SPCA5XX don't work together
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-27 21:00 EST by Panos Prokopiou
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-09 19:44:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Panos Prokopiou 2006-02-27 21:00:15 EST
Description of problem:

I can't get spca5xx module working when compiling with
gcc version 4.1.0 20060219 (Red Hat 4.1.0-0.29). 
The system freezes when the device /dev/video0 is read. I tried to track the
problem, located (not fixed) around *_interruptible calls BUT it doesn't seem to
be a kernel bug because suse's gcc 4.0 (and a little editing to change 4.0 to
4.1 to make the module load) was enough to make my webcam work.

..or it's binutils fault?

Version-Release number of selected component (if applicable):

[pprok@localhost spca5xx-20060202]$ rpm -qa | grep kernel
kernel-2.6.15-1.1977_FC5 (sources are installed as discribed on release notes)

spca5xx-20060202

[pprok@localhost spca5xx-20060202]$ gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.0 20060219 (Red Hat 4.1.0-0.29)

[pprok@localhost spca5xx-20060202]$ env LD_LIBRARY_PATH=/lib:/mnt/usr/lib
/mnt/usr/bin/gcc -v
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man
--libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,f95,java,ada --disable-checking
--with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk
--disable-libjava-multilib --with-slibdir=/lib --with-system-zlib
--enable-shared --enable-__cxa_atexit --without-system-libunwind
--host=i586-suse-linux
Thread model: posix
gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)


How reproducible:

#include <stdio.h>

int main(int argc, char ** argv) {
        FILE* video;
        char tmp;

        video = fopen("/dev/video0", "r");
        if (!video) {
                printf("Cannot open /dev/video0\n");
                exit(-1);
        }
        if (1 != fread(&tmp, 1, 1, video)) // PROBLEM
                printf("Cannot read /dev/video0\n");
        if (EOF == fclose(video)) {
                printf("Cannot close /dev/video0\n");
                exit(-1);
        }

        return 0;
}

Steps to Reproduce:
1. build the module
2. load it
3. try to open /dev/video0, either using cat, or my prog
4. the system dies and needs a cold reboot (usally it just auto reboots instantly)
  
Additional info:
Fedora Core 5 Test3
[pprok@localhost spca5xx-20060202]$ make clean ; make V=1
rm -r -f drivers/usb/*.o drivers/usb/.spcadecoder.o.cmd \
drivers/usb/.spca5xx.o.cmd  *.o *.ko *.mod.* .[a-z]* core *.i
   Building SPCA5XX driver for 2.5/2.6 kernel.
   Remember: you must have read/write access to your kernel source tree.
make -C /lib/modules/`uname -r`/build SUBDIRS=/home/pprok/tmp/spca5xx-20060202
CC=cc modules
make[1]: Entering directory `/usr/src/linux-2.6.15.i686'
mkdir -p /home/pprok/tmp/spca5xx-20060202/.tmp_versions
make -f scripts/Makefile.build obj=/home/pprok/tmp/spca5xx-20060202
  cc -Wp,-MD,/home/pprok/tmp/spca5xx-20060202/drivers/usb/.spca5xx.o.d 
-nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.0/include -D__KERNEL__
-Iinclude  -include include/linux/autoconf.h -Iinclude/asm-i386/mach-default
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -ffreestanding -Os     -fomit-frame-pointer -g -pipe -msoft-float
-fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts 
-mpreferred-stack-boundary=2  -march=i686 -mtune=pentium4 -mregparm=3
-Iinclude/asm-i386/mach-default -Wdeclaration-after-statement -Wno-pointer-sign
 -DSPCA50X_ENABLE_DEBUG -DSPCA50X_ENABLE_COMPRESSION
-DCONFIG_USB_SPCA5XX_MODULE=1 -DMODULE -D__KERNEL__ -DVID_HARDWARE_SPCA5XX=0xFF
-DSPCA5XX_VERSION=\"00.57.09\"    -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(spca5xx)"  -D"KBUILD_MODNAME=KBUILD_STR(spca5xx)"
-c -o /home/pprok/tmp/spca5xx-20060202/drivers/usb/.tmp_spca5xx.o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spca5xx.c
  cc -Wp,-MD,/home/pprok/tmp/spca5xx-20060202/drivers/usb/.spcadecoder.o.d 
-nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.0/include -D__KERNEL__
-Iinclude  -include include/linux/autoconf.h -Iinclude/asm-i386/mach-default
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -ffreestanding -Os     -fomit-frame-pointer -g -pipe -msoft-float
-fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts 
-mpreferred-stack-boundary=2  -march=i686 -mtune=pentium4 -mregparm=3
-Iinclude/asm-i386/mach-default -Wdeclaration-after-statement -Wno-pointer-sign
 -DSPCA50X_ENABLE_DEBUG -DSPCA50X_ENABLE_COMPRESSION
-DCONFIG_USB_SPCA5XX_MODULE=1 -DMODULE -D__KERNEL__ -DVID_HARDWARE_SPCA5XX=0xFF
-DSPCA5XX_VERSION=\"00.57.09\"    -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(spcadecoder)" 
-D"KBUILD_MODNAME=KBUILD_STR(spca5xx)" -c -o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/.tmp_spcadecoder.o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spcadecoder.c
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spcadecoder.c: In function ‘fun_D’:
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spcadecoder.c:756: warning: value
computed is not used
  ld -m elf_i386 -m elf_i386  -r -o /home/pprok/tmp/spca5xx-20060202/spca5xx.o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spca5xx.o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spcadecoder.o
  Building modules, stage 2.
make -rR -f /usr/src/linux-2.6.15.i686/scripts/Makefile.modpost
  scripts/mod/modpost -m -a -i /usr/src/linux-2.6.15.i686/Module.symvers
/home/pprok/tmp/spca5xx-20060202/spca5xx.o
  cc -Wp,-MD,/home/pprok/tmp/spca5xx-20060202/.spca5xx.mod.o.d  -nostdinc
-isystem /usr/lib/gcc/i386-redhat-linux/4.1.0/include -D__KERNEL__ -Iinclude 
-include include/linux/autoconf.h -Iinclude/asm-i386/mach-default -Wall -Wundef
-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-ffreestanding -Os     -fomit-frame-pointer -g -pipe -msoft-float
-fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts 
-mpreferred-stack-boundary=2  -march=i686 -mtune=pentium4 -mregparm=3
-Iinclude/asm-i386/mach-default -Wdeclaration-after-statement -Wno-pointer-sign
   -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(spca5xx)" 
-D"KBUILD_MODNAME=KBUILD_STR(spca5xx)" -DMODULE -c -o
/home/pprok/tmp/spca5xx-20060202/spca5xx.mod.o
/home/pprok/tmp/spca5xx-20060202/spca5xx.mod.c
  ld -m elf_i386 -m elf_i386 -r -o /home/pprok/tmp/spca5xx-20060202/spca5xx.ko
/home/pprok/tmp/spca5xx-20060202/spca5xx.o
/home/pprok/tmp/spca5xx-20060202/spca5xx.mod.o
make[1]: Leaving directory `/usr/src/linux-2.6.15.i686'


SUSE 10.0
[pprok@localhost spca5xx-20060202]$ make clean; env
LD_LIBRARY_PATH=/lib:/mnt/usr/lib make CC=/mnt/usr/bin/gcc V=1
rm -r -f drivers/usb/*.o drivers/usb/.spcadecoder.o.cmd \
drivers/usb/.spca5xx.o.cmd  *.o *.ko *.mod.* .[a-z]* core *.i
   Building SPCA5XX driver for 2.5/2.6 kernel.
   Remember: you must have read/write access to your kernel source tree.
make -C /lib/modules/`uname -r`/build SUBDIRS=/home/pprok/tmp/spca5xx-20060202
CC=/mnt/usr/bin/gcc modules
make[1]: Entering directory `/usr/src/linux-2.6.15.i686'
mkdir -p /home/pprok/tmp/spca5xx-20060202/.tmp_versions
make -f scripts/Makefile.build obj=/home/pprok/tmp/spca5xx-20060202
  /mnt/usr/bin/gcc
-Wp,-MD,/home/pprok/tmp/spca5xx-20060202/drivers/usb/.spca5xx.o.d  -nostdinc
-isystem /mnt/usr/bin/../lib/gcc/i586-suse-linux/4.0.2/include -D__KERNEL__
-Iinclude  -include include/linux/autoconf.h -Iinclude/asm-i386/mach-default
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -ffreestanding -Os     -fomit-frame-pointer -g -pipe -msoft-float
-fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts 
-mpreferred-stack-boundary=2  -march=i686 -mtune=pentium4 -mregparm=3
-Iinclude/asm-i386/mach-default -Wdeclaration-after-statement -Wno-pointer-sign
 -DSPCA50X_ENABLE_DEBUG -DSPCA50X_ENABLE_COMPRESSION
-DCONFIG_USB_SPCA5XX_MODULE=1 -DMODULE -D__KERNEL__ -DVID_HARDWARE_SPCA5XX=0xFF
-DSPCA5XX_VERSION=\"00.57.09\"    -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(spca5xx)"  -D"KBUILD_MODNAME=KBUILD_STR(spca5xx)"
-c -o /home/pprok/tmp/spca5xx-20060202/drivers/usb/.tmp_spca5xx.o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spca5xx.c
  /mnt/usr/bin/gcc
-Wp,-MD,/home/pprok/tmp/spca5xx-20060202/drivers/usb/.spcadecoder.o.d  -nostdinc
-isystem /mnt/usr/bin/../lib/gcc/i586-suse-linux/4.0.2/include -D__KERNEL__
-Iinclude  -include include/linux/autoconf.h -Iinclude/asm-i386/mach-default
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -ffreestanding -Os     -fomit-frame-pointer -g -pipe -msoft-float
-fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts 
-mpreferred-stack-boundary=2  -march=i686 -mtune=pentium4 -mregparm=3
-Iinclude/asm-i386/mach-default -Wdeclaration-after-statement -Wno-pointer-sign
 -DSPCA50X_ENABLE_DEBUG -DSPCA50X_ENABLE_COMPRESSION
-DCONFIG_USB_SPCA5XX_MODULE=1 -DMODULE -D__KERNEL__ -DVID_HARDWARE_SPCA5XX=0xFF
-DSPCA5XX_VERSION=\"00.57.09\"    -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(spcadecoder)" 
-D"KBUILD_MODNAME=KBUILD_STR(spca5xx)" -c -o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/.tmp_spcadecoder.o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spcadecoder.c
  ld -m elf_i386 -m elf_i386  -r -o /home/pprok/tmp/spca5xx-20060202/spca5xx.o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spca5xx.o
/home/pprok/tmp/spca5xx-20060202/drivers/usb/spcadecoder.o
  Building modules, stage 2.
make -rR -f /usr/src/linux-2.6.15.i686/scripts/Makefile.modpost
  scripts/mod/modpost -m -a -i /usr/src/linux-2.6.15.i686/Module.symvers
/home/pprok/tmp/spca5xx-20060202/spca5xx.o
  /mnt/usr/bin/gcc -Wp,-MD,/home/pprok/tmp/spca5xx-20060202/.spca5xx.mod.o.d 
-nostdinc -isystem /mnt/usr/bin/../lib/gcc/i586-suse-linux/4.0.2/include
-D__KERNEL__ -Iinclude  -include include/linux/autoconf.h
-Iinclude/asm-i386/mach-default -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -ffreestanding -Os     -fomit-frame-pointer -g
-pipe -msoft-float -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts 
-mpreferred-stack-boundary=2  -march=i686 -mtune=pentium4 -mregparm=3
-Iinclude/asm-i386/mach-default -Wdeclaration-after-statement -Wno-pointer-sign
   -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(spca5xx)" 
-D"KBUILD_MODNAME=KBUILD_STR(spca5xx)" -DMODULE -c -o
/home/pprok/tmp/spca5xx-20060202/spca5xx.mod.o
/home/pprok/tmp/spca5xx-20060202/spca5xx.mod.c
  ld -m elf_i386 -m elf_i386 -r -o /home/pprok/tmp/spca5xx-20060202/spca5xx.ko
/home/pprok/tmp/spca5xx-20060202/spca5xx.o
/home/pprok/tmp/spca5xx-20060202/spca5xx.mod.o
make[1]: Leaving directory `/usr/src/linux-2.6.15.i686'
Comment 1 Jakub Jelinek 2006-02-28 03:08:19 EST
That doesn't imply it is a GCC bug, it might very well be a kernel bug, where
e.g. its undefined behavior exhibits different observable behavior depending on
optimizations GCC is doing.  I don't have such a webcam, so unless you debug
which exact function gets miscompiled (if any) with which gcc options, there is
nothing I can do about it.
You should try:
1) if the module consists of several .c source files, try to do say a binary
   search, compile some files with GCC 4.1, some with GCC 4.0 and load that
   into GCC 4.1. compiled kernel
2) try different optimization options (-O1, -O2, -Os)
3) when you locate particular .c file, you can do a binary search within it,
   if say -O1 or -O2 instead of -Os helps, then compile the file with
   -Os and with -O2 into assembly, then weld first half of the routines from
   one .s file with second half of the routines with the other file etc.
   (or with GCC 4.0 vs. GCC 4.1)
Alternatively, try to figure out where exactly it hangs and debug why.
Comment 2 Panos Prokopiou 2006-03-09 19:44:40 EST
it just needed -fno-unit-at-a-time. The driver IMHO is a mess. It has even
function definitions inside header files. I cannot blame gcc or kernel for this...
Anyway, it is NOTABUG, it is AMESS.
Comment 3 Panos Prokopiou 2006-03-09 19:47:13 EST
it just needed -fno-unit-at-a-time. This driver is a total mess IHMO. It even
has function definitions inside header files. GCC and kernel not to blame. so
NOTABUG,  AMESS really.

Note You need to log in before you can comment on or make changes to this bug.