Bug 59313

Summary: Cannot compile kernel module which defines MODVERSIONS and includes <asm/io.h>
Product: [Retired] Red Hat Linux Reporter: Need Real Name <yaron_pinto>
Component: kernelAssignee: Arjan van de Ven <arjanv>
Status: CLOSED WORKSFORME QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-02-05 08:00:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2002-02-05 01:04:28 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901

Description of problem:
I get the following error:

In file included from /lib/modules/2.4.7-10/build/include/asm/io.h:110,
                 from test.c:13:
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h: In function `vmalloc':
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h:35:
`boot_cpu_data_R65dda927' undeclared (first use in this function)


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

How reproducible:
Always

Steps to Reproduce:
1. Compile module test.c in "additional information":
gcc -D__KERNEL__ -I/lib/modules/2.4.7-10/build/include -DMODULE -Wall -O2  -c -o
test.o test.c


Actual Results:  
In file included from /lib/modules/2.4.7-10/build/include/linux/fs.h:19,
                 from /lib/modules/2.4.7-10/build/include/linux/capability.h:17,
                 from /lib/modules/2.4.7-10/build/include/linux/binfmts.h:5,
                 from /lib/modules/2.4.7-10/build/include/linux/sched.h:9,
                 from /lib/modules/2.4.7-10/build/include/linux/vmalloc.h:4,
                 from /lib/modules/2.4.7-10/build/include/asm/io.h:110,
                 from test.c:13:
/lib/modules/2.4.7-10/build/include/linux/dcache.h: In function `dget':
/lib/modules/2.4.7-10/build/include/linux/dcache.h:246: warning: implicit
declaration of function `do_BUG_R577f4bff'
In file included from /lib/modules/2.4.7-10/build/include/asm/io.h:110,
                 from test.c:13:
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h: In function `vmalloc':
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h:35:
`boot_cpu_data_R65dda927' undeclared (first use in this function)
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h:35: (Each undeclared
identifier is reported only once
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h:35: for each function it
appears in.)
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h: In function `vmalloc_dma':
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h:44:
`boot_cpu_data_R65dda927' undeclared (first use in this function)
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h: In function `vmalloc_32':
/lib/modules/2.4.7-10/build/include/linux/vmalloc.h:53:
`boot_cpu_data_R65dda927' undeclared (first use in this function)


Expected Results:  Clean compile - no warnings or errors.

Additional info:

Note that this is a complete clean install of RH 7.2 with no updates.
The same module compiles OK on a clean install of RH 7.1.

Also note that if I comment out the lines regarding MODVERSIONS, then
it compiles OK.

// test.c

#include <linux/module.h>

#if defined(CONFIG_SMP)
#define __SMP__
#endif

#if defined(CONFIG_MODVERSIONS)
#define MODVERSIONS
#include <linux/modversions.h>
#endif

#include <linux/kernel.h>
#include <asm/io.h>

int init_module(void)      { printk("<7>INIT - Test\n"); return 0; }
void cleanup_module(void)  { printk("<7>CLEANUP - Test\n"); }

Comment 1 Arjan van de Ven 2002-02-05 08:00:12 UTC
3 things: 
1) Your code is buggy in 2 ways. You NEVER EVER include modversions.h directly.
   Esp not in the way you do.
   Also do not use __SMP__ but just CONFIG_SMP. If you need 2.0 compatibility
do    it the other way around

2) Please download http://people.redhat.com/arjanv/xircom_cb/Makefile
   and edit to change the filename. That will make it work.

3) If this is for a binary only module, please don't and consider making it GPL.
Red Hat will be more than willing to work with you to get the hardware supported
for the next release and updated kernels.