Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 154213 - Can't compile kernel module due to strange udelay error
Summary: Can't compile kernel module due to strange udelay error
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc34
Version: 3
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-04-08 14:38 UTC by SA
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-07-19 14:26:40 UTC


Attachments (Terms of Use)
preprocessed code for diagnosis (deleted)
2005-04-08 15:30 UTC, SA
no flags Details

Description SA 2005-04-08 14:38:09 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1

Description of problem:
I cannot compile a kernel driver due to a strange udelay error.  My money is on the compiler misbehaving.

*** Warning: "__bad_udelay" [/home/matt/temp/export/driver_2.6/slm.ko] undefined!

This code faultlessly compiles on all the other machines / version we have including an FC2 machine running the exact same kernel.  The only differnece seems to be the compiler.

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

How reproducible:
Always

Steps to Reproduce:
1. Try to compile the driver code with the offending line:
"udelay(slm.DPEN_delay);" in it using gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)


  

Actual Results:  make -C /lib/modules/2.6.10-1.770_FC3/build M=/home/matt/temp/export/driver_2.6 modules
make[1]: Entering directory `/lib/modules/2.6.10-1.770_FC3/build'
  Building modules, stage 2.
  MODPOST
*** Warning: "__bad_udelay" [/home/matt/temp/export/driver_2.6/slm.ko] undefined!
make[1]: Leaving directory `/lib/modules/2.6.10-1.770_FC3/build'


Expected Results:  on an FC2 machine with the same kernel gcc version 3.3.3 

make
make -C /lib/modules/2.6.5-1.358/build M=/home/scan/source/dev/BNS/driver_2.6 modules
make[1]: Entering directory `/lib/modules/2.6.5-1.358/build'
  CC [M]  /home/scan/source/dev/BNS/driver_2.6/slm.o
/home/scan/source/dev/BNS/driver_2.6/slm.c: In function `init_BNS_SLM':
/home/scan/source/dev/BNS/driver_2.6/slm.c:231: warning: int format, different type arg (arg 2)
  Building modules, stage 2.
  MODPOST
  CC      /home/scan/source/dev/BNS/driver_2.6/slm.mod.o
  LD [M]  /home/scan/source/dev/BNS/driver_2.6/slm.ko
make[1]: Leaving directory `/lib/modules/2.6.5-1.358/build'


Additional info:

This fails on this machine:
[root@valium driver_2.6]# uname -a
Linux valium 2.6.10-1.770_FC3 #1 Thu Feb 24 18:09:38 EST 2005 x86_64 x86_64 x86_64 GNU/Linux
[root@valium driver_2.6]# gcc --ver
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,java,f77 --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

but works on this machine:
[root@armchair driver_2.6]# uname -a
Linux armchair.eee.nottingham.ac.uk 2.6.5-1.358 #1 Sat May 8 09:01:26 EDT 2004 x86_64 x86_64 x86_64 GNU/Linux
[root@armchair driver_2.6]# gcc --ver
Reading specs from /usr/lib/gcc-lib/x86_64-redhat-linux/3.3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --disable-libunwind-exceptions --with-system-zlib --enable-__cxa_atexit --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)

and works on many other machines.


The offending kernel headers which produces the error is <exactly> the same on all the tested platforms.

It is a puzzling error because it can only normally happen iff udelay is called with a constant and the constant is greater than 20000.  In this case udelay is called with a variable (which is initially set to 1000).

Comment 1 SA 2005-04-08 14:40:02 UTC
It is possibly similar to an old bug #29487.

The driver code is GPL and available on request (this driver is only used on 1/2
dozen systems worldwide).



Comment 2 Jakub Jelinek 2005-04-08 15:12:48 UTC
Please preprocess slm.c (e.g. add -save-temps to the gcc command that compiles
it) and attach here.  __bad_udelay is intentionally not defined anywhere,
it is supposed to be a link time warning that somebody called udelay with
bogus argument.  The preprocessed file will tell if that's the case...

Comment 3 SA 2005-04-08 15:30:22 UTC
Created attachment 112857 [details]
preprocessed code for diagnosis

Enclose the preprocess slm.i file - if you require any others let me know.

I understand what bad_udelay is - I can't see why I am getting it.

Comment 4 Jakub Jelinek 2005-05-10 13:50:34 UTC
What exact GCC options were used?  I can't reproduce it with
either -march=i386 or -march=i686, -O2 or -Os, -fomit-frame-pointer or
-fno-omit-frame-pointer.

Comment 5 Jakub Jelinek 2005-07-19 14:26:40 UTC
No response, closing.


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