pecenin
07-14-2005, 11:23 AM
Hello,
I'm writing a simple 2.6.7 kernel module that use complex.h (cexp, cimag, creal, etc...). It compile correct, see below:
--------------
make -C /usr/src/linux SUBDIRS=/home/pecenin/modulo modules
make[1]: Entering directory `/usr/src/linux-2.6.7'
CC [M] /home/pecenin/modulo/mat.o
CC [M] /home/pecenin/modulo/modu.o
LD [M] /home/pecenin/modulo/modcalc.o
Building modules, stage 2.
MODPOST
CC /home/pecenin/modulo/modcalc.mod.o
LD [M] /home/pecenin/modulo/modcalc.ko
make[1]: Leaving directory `/usr/src/linux-2.6.7'
----------------
but when I load with 'insmod modcalc.ko' I get, from 'dmesg':
----------
modcalc: Unknown symbol __fixdfsi
modcalc: Unknown symbol cexp
----------
The makefile used is:
-------------
EXTRA_CFLAGS := -I$(src) -I/usr/include
EXTRA_LDFLAGS := -L/usr/lib --start-group -lm --end-group
obj-m := modcalc.o
modcalc-objs := mat.o modu.o
KDIR := /usr/src/linux
LDIR := $(PWD)
all:
make -C $(KDIR) SUBDIRS=$(LDIR) modules
clean:
rm -rf *.o *.ko *.mod.o *.mod.c
-------------
and the source code:
----------- mat.c ----------
#include <mat.h>
#include <complex.h>
int valor = 0;
int calculo(void)
{
valor = (int)creal(cexp(0));
return ++valor;
}
-----------------
--------- mat.h ----------
#ifndef MAT_H
#define MAT_H
extern int valor;
int calculo(void);
#endif
---------------------
---------- modu.c ------
#include <mat.h>
#include <linux/module.h>
#include <linux/init.h>
MODULE_LICENSE("GPL");
int __init modu_init(void)
{
int x = 1;
printk("<0>Carregou\n");
x = calculo();
return x - x;
}
void __exit modu_cleanup(void)
{
printk("<0>Descarregou\n");
}
module_init(modu_init);
module_exit(modu_cleanup);
----------
Someone know what I'm doing wrong?
All helps will be appreciated!
Pecenin
I'm writing a simple 2.6.7 kernel module that use complex.h (cexp, cimag, creal, etc...). It compile correct, see below:
--------------
make -C /usr/src/linux SUBDIRS=/home/pecenin/modulo modules
make[1]: Entering directory `/usr/src/linux-2.6.7'
CC [M] /home/pecenin/modulo/mat.o
CC [M] /home/pecenin/modulo/modu.o
LD [M] /home/pecenin/modulo/modcalc.o
Building modules, stage 2.
MODPOST
CC /home/pecenin/modulo/modcalc.mod.o
LD [M] /home/pecenin/modulo/modcalc.ko
make[1]: Leaving directory `/usr/src/linux-2.6.7'
----------------
but when I load with 'insmod modcalc.ko' I get, from 'dmesg':
----------
modcalc: Unknown symbol __fixdfsi
modcalc: Unknown symbol cexp
----------
The makefile used is:
-------------
EXTRA_CFLAGS := -I$(src) -I/usr/include
EXTRA_LDFLAGS := -L/usr/lib --start-group -lm --end-group
obj-m := modcalc.o
modcalc-objs := mat.o modu.o
KDIR := /usr/src/linux
LDIR := $(PWD)
all:
make -C $(KDIR) SUBDIRS=$(LDIR) modules
clean:
rm -rf *.o *.ko *.mod.o *.mod.c
-------------
and the source code:
----------- mat.c ----------
#include <mat.h>
#include <complex.h>
int valor = 0;
int calculo(void)
{
valor = (int)creal(cexp(0));
return ++valor;
}
-----------------
--------- mat.h ----------
#ifndef MAT_H
#define MAT_H
extern int valor;
int calculo(void);
#endif
---------------------
---------- modu.c ------
#include <mat.h>
#include <linux/module.h>
#include <linux/init.h>
MODULE_LICENSE("GPL");
int __init modu_init(void)
{
int x = 1;
printk("<0>Carregou\n");
x = calculo();
return x - x;
}
void __exit modu_cleanup(void)
{
printk("<0>Descarregou\n");
}
module_init(modu_init);
module_exit(modu_cleanup);
----------
Someone know what I'm doing wrong?
All helps will be appreciated!
Pecenin