Simple question.. how to compile driver to be profiled with Gprof?
My current Makefile:
obj-m += hello-2.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
Works just fine ( I can load the driver etc. ), but if I try to add -pg options to the file then I get an error.
Makefile:
obj-m += hello-2.o
EXTRA_CFLAGS += -pg
LDFLAGS += -pg
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 get error:
make -C /lib/modules/2.6.31/build M=/home/I/drivertest modules
make[1]: Entering directory `/home/I/linux-2.6.31'
CC [M] /home/I/drivertest/hello-2.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "mcount" [/home/I/drivertest/hello-2.ko] undefined!
CC /home/I/drivertest/hello-2.mod.o
LD [M] /home/I/drivertest/hello-2.ko
ld: unrecognized option '-pg'
ld: use the --help option for usage information
make[2]: *** [/home/I/drivertest/hello-2.ko] Error 1
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/home/I/linux-2.6.31'
make: *** [all] Error 2