I am working on a Linux kernel module for the 2.6.x kernel, and I need to look at the output of the assembly, although it is currently being done as a temporary file, deleted afterword. I would like the assembly to be mixed with my source C file, so I can easily track where my problem is. This is for the ARMv6 kernel, and apparently objdump does not support this architecture. I have included my makefile below.
ETREP=/xxSourceTreexx/ GNU_BIN=$(ETREP)/arm-none-linux-gnueabi/bin CROSS_COMPILE := $(GNU_BIN)/arm-none-linux-gnueabi- ARCH := arm KDIR=$(ETREP)/linux-2.6.31/ MAKE= CROSS_COMPILE=$(CROSS_COMPILE) ARCH=$(ARCH) make obj-m += xxfile1xx.o all: $(MAKE) -C $(KDIR) M=$(PWD) modules clean: $(MAKE) -C $(KDIR) M=$(PWD) clean
Objdump supports this architecture. Your executable will be calledarm-none-linux-gnueabi-objdump
arm-none-linux-gnueabi-objdump
, gcc gnu , objdump. gcc:
objdump
-Wa,-alh=basename.s
basename , make:
basename
-Wa,-alh=$<.s
foo.c.s, . , , gcc, . gcc , .
Makefile CFLAGS ( "" "gnu info" .
Linux, /Makefile.build.
#cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< cmd_cc_o_c = $(CC) $(c_flags) -c -Wa,-alh=$<.lst -o $(@D)/.tmp_$(@F) $<
You can try the "-save-temps" flag in gcc. It works for me in my embedded project, I have not tried it when building the kernel.