Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3248

Kernel modules and -fno-pic (4 replies)

$
0
0
Has anyone that builds loadable kernel modules run into the requirement for a -fno-pic compiler flag? I have a couple of lkms I created a few years ago and when I went to modify one I suddenly get "wx_lkm: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)" when I make and insmod it. I don't believe I've changed anything and I never needed the flag before, but searching for the error led me to -fno-pic. My Makefile was very simple:
obj-m+=wx_lkm.o

all:
        make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
clean:
        make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean
I had to change it to:
obj-m+=wx_lkm.o

all:
        make -C /lib/modules/$(shell uname -r)/build/ EXTRA_CFLAGS=-fno-pic M=$(PWD) modules
clean:
        make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean

It bugs me more than anything since it works with the compiler flag. I'm just wondering what I might have screwed up to make it suddenly require the flag. I've been using the same kernel that's long overdue for an update since I started developing the lkms.

Viewing all articles
Browse latest Browse all 3248

Trending Articles