Re: basic module bug

From: Bob McElrath (mcelrath@draal.physics.wisc.edu)
Date: Sat Aug 25 2001 - 10:56:45 EST


Also I don't know if I mentioned this is on the alpha architecture.
I've tried egcs 2.91.66, gcc-2.96-85 (redhat), binutils-2.10.91.0.2-3.
All kernel versions I've tried (2.4.4, 2.4.5, 2.4.7, 2.4.9, 2.2.19)
generate the same message. What am I doing wrong?

Where can I find a "skeleton" kernel module for comparison?

Bob McElrath [mcelrath@draal.physics.wisc.edu] wrote:
> Evgeny Polyakov [johnpol@2ka.mipt.ru] wrote:
> > How do you compile this module?
> > I've just trying to do this with the following command and all is OK:
> > gcc ./test.c -c -o ./test.o -D__KERNEL__ -DMODULE.
>
> That's because if you -D__KERNEL__ the whole file is ifdef'ed out. ;)
>
> Remove the #ifdef __KERNEL__ stuff if you want to compile it that way.

Here's a simpler case more compatible with the options passed to gcc
when the kernel is compiled:

    /* test module. Compile with: gcc -c -I/usr/src/linux/include
     * -D__KERNEL__ -DMODULE test.c */
    #include <linux/module.h>
    #include <linux/kernel.h>
    #include <asm/current.h>
    #ifdef MODULE
     int init_module(void)
    #else
     int test_init(void)
    #endif
     {
             return 0;
     }
    #ifdef MODULE
     void cleanup_module(void)
     {
     }
    #endif

(0)<mcelrath@draal:/home/mcelrath> gcc -c -I/usr/src/linux/include -D__KERNEL__ -DMODULE test.c
In file included from test.c:5:
/usr/src/linux/include/asm/current.h:4: warning: call-clobbered register used for global register variable

Yet a simpler case:

    #include <asm/current.h>
    int main() {}

Generates the same warning message. Why does this message not occur
when compiling the kernel?

Cheers,
-- Bob

Bob McElrath (rsmcelrath@students.wisc.edu)
Univ. of Wisconsin at Madison, Department of Physics



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Aug 31 2001 - 21:00:18 EST