Bug 154213 - Can't compile kernel module due to strange udelay error
Can't compile kernel module due to strange udelay error
Status: CLOSED WORKSFORME
Product: Fedora
Classification: Fedora
Component: gcc34 (Show other bugs)
3
x86_64 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-08 10:38 EDT by SA
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: 2005-07-19 10:26:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
preprocessed code for diagnosis (367.02 KB, text/plain)
2005-04-08 11:30 EDT, SA
no flags Details

  None (edit)
Description SA 2005-04-08 10:38:09 EDT
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 10:40:02 EDT
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 11:12:48 EDT
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 11:30:22 EDT
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 09:50:34 EDT
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 10:26:40 EDT
No response, closing.

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