Re: kernel load issues (insmod segfault)

From: Toralf Lund
Date: Fri Apr 01 2005 - 09:01:52 EST


Toralf Lund wrote:

Hi.

I thought I might try this one again (with updated code and more compete info):

Right. I think maybe I've made some kind of stupid mistake. Sorry.

I looked, and looked again, and just couldn't find anything wrong with the module (so it must be the kernel, right?), but I looked the wrong place, of course. It was the build flags, not the source code...

[ ... ]



# make itifg8tst.o
gcc -pipe -Wall -O2 -DLinux -mcpu=i686 -I../../include -fno-common -fno-strict-aliasing -fomit-frame-pointer -nostdinc -I. -I/lib/modules/2.6.11.4-0.EL.toralf/build/include -I/usr/lib/gcc/i386-redhat-linux/3.4.3/include -D__KERNEL__ -DMODULE -I/lib/modules/2.6.11.4-0.EL.toralf/build/include/asm-i386/mach-default -o itifg8tst.o -c itifg8tst.c

It seems like this is not quite right. I've now changed this build flags based on the module build setup of the kernel sources, so that I have

gcc -DLinux -mpreferred-stack-boundary=2 -fno-unit-at-a-time -march=i686 -mregparm=3 -I../../include -fno-strict-aliasing -fno-common -ffreestanding -fomit-frame-pointer -nostdinc -I. -I/lib/modules/2.6.11.4-0.EL.toralf/build/include -isystem /usr/lib/gcc/i386-redhat-linux/3.4.3/include -D__KERNEL__ -DMODULE -I/lib/modules/2.6.11.4-0.EL.toralf/build/include/asm-i386/mach-default -o itifg8.mod.o -c itifg8.mod.c

and the module works!

I'm not sure what exactly did the trick, though. (Although I guess the distinction between -march and just -mcpu might be significant.). If someone would like to explain more about the different flags, just go ahead....

- Toralf

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