kbuild: implement "make foo.s_c"
RFC PATCH 1/1 kbuild: implement "make foo.s_c"
This patch implements "make path/to/file.s_c", where "file.s_c" is a file contains both asm and C code, this is helpful for people to do debugging at asm level.
Currently, we have "make path/to/file.s", but it sucks, the asm code generated by it is not human-friendly.
Compare "make kernel/spinlock.s" with "make kernel/spinlock.s_c", as an example.
---
.gitignore +1 -0
@@ -14,6 +14,7 @@ *.o.* *.a *.s +*.s_c *.ko *.so *.so.dbg
Makefile +3 -1
@@ -1216,7 +1216,7 @@ clean: archclean $(clean-dirs) @find . $(RCS_FIND_IGNORE) \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ - -o -name '*.symtypes' -o -name 'modules.order' \ + -o -name '*.s_c' -o -name '*.symtypes' -o -name 'modules.order' \ -o -name 'Module.markers' -o -name '.tmp_*.o.*' \ -o -name '*.gcno' \) -type f -print | xargs rm -f
@@ -1520,6 +1520,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.s: %.S prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.s_c: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.o: %.S prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE
scripts/Makefile.build +5 -0
@@ -148,6 +148,11 @@ cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $< $(obj)/%.s: $(src)/%.c FORCE $(call if_changed_dep,cc_s_c) +cmd_cc_s_c_c = $(OBJDUMP) -d -S $< >$@ + +$(obj)/%.s_c: $(src)/%.o FORCE + $(call if_changed,cc_s_c_c) + quiet_cmd_cc_i_c = CPP $(quiet_modtag) $@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
Quoted 3 lines · On Fri, 4 Sep 2009 01:30:06 -0400 Amerigo Wang <[email protected]> wrote:
This patch implements "make path/to/file.s_c", where "file.s_c" is a file contains both asm and C code, this is helpful for people to do debugging at asm level.
Try
make path/to/file.lst
:)
Quoted 11 lines · Andrew Morton
Quoted 3 lines · On Fri, 4 Sep 2009 01:30:06 -0400 Amerigo Wang <[email protected]> wrote:
This patch implements "make path/to/file.s_c", where "file.s_c" is a file contains both asm and C code, this is helpful for people to do debugging at asm level.
Try
make path/to/file.lst
:)
Wow, I never know it before. Thanks!
But the name 'file.lst' is a little bit confusing for me. :-/
How about renaming it to other more meaningful name, e.g. 'file.s_c'? :)
Thanks.