[2/12] kbuild/sparc: Use new generic mksysmap script to generate System.map

From: Sam Ravnborg
Date: Fri Aug 13 2004 - 14:53:24 EST


# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/08 09:34:43+02:00 sam@xxxxxxxxxxxxxxxxx
# kbuild/sparc: Use new generic mksysmap script to generate System.map
#
# o Introduced usage of the mksysmap script.
# o Improved the non-verbose output to look like this:
# BTFIX arch/sparc/boot/btfix.S
# AS arch/sparc/boot/btfix.o
# LD arch/sparc/boot/image
# SYSMAP arch/sparc/boot/System.map
#
# o No longer generate System.map for each build
# o Use normal AS rule to compile btfix.S
#
# Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
#
# scripts/mksysmap
# 2004/08/08 09:34:27+02:00 sam@xxxxxxxxxxxxxxxxx +1 -1
# Three, not four underscores
#
# arch/sparc/boot/Makefile
# 2004/08/08 09:34:27+02:00 sam@xxxxxxxxxxxxxxxxx +32 -8
# Use the new mksysmap script
# Do not generate System.map for every build
# Use normal AS rule for btfix.S
#
diff -Nru a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
--- a/arch/sparc/boot/Makefile 2004-08-13 21:09:21 +02:00
+++ b/arch/sparc/boot/Makefile 2004-08-13 21:09:21 +02:00
@@ -8,27 +8,51 @@
ELFTOAOUT := elftoaout

host-progs := piggyback btfixupprep
-targets := tftpboot.img btfix.o btfix.s image
+targets := tftpboot.img btfix.o btfix.S image

quiet_cmd_elftoaout = ELFTOAOUT $@
cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
-quiet_cmd_piggy = PIGGY $@
+quiet_cmd_piggy = PIGGY $@
cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG)
-quiet_cmd_btfix = BTFIX $@
+quiet_cmd_btfix = BTFIX $@
cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
+quiet_cmd_sysmap = SYSMAP $(obj)/System.map
+ cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
+quiet_cmd_image = LD $@
+ cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@
+
+define rule_image
+ $(if $($(quiet)cmd_image), \
+ echo ' $($(quiet)cmd_image)' &&) \
+ $(cmd_image); \
+ $(if $($(quiet)cmd_sysmap), \
+ echo ' $($(quiet)cmd_sysmap)' &&) \
+ $(cmd_sysmap) $@ $(obj)/System.map; \
+ if [ $$? -ne 0 ]; then \
+ rm -f $@; \
+ /bin/false; \
+ fi; \
+ echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
+endef

BTOBJS := $(HEAD_Y) $(INIT_Y)
BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y)
-LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) --start-group $(BTLIBS) --end-group $(kallsyms.o)
+LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) \
+ --start-group $(BTLIBS) --end-group \
+ $(kallsyms.o) $(obj)/btfix.o

-# Actual linking
+# Link the final image including btfixup'ed symbols.
+# This is a replacement for the link done in the top-level Makefile.
+# Note: No dependency on the prerequisite files since that would require
+# make to try check if they are updated - and due to changes
+# in gcc options (path for example) this would result in
+# these files being recompiled for each build.
$(obj)/image: $(obj)/btfix.o FORCE
- $(call if_changed,ld)
- $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(obj)/System.map
+ $(call if_changed_rule,image)

$(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
$(call if_changed,elftoaout)
$(call if_changed,piggy)

-$(obj)/btfix.s: $(obj)/btfixupprep vmlinux FORCE
+$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
$(call if_changed,btfix)
diff -Nru a/scripts/mksysmap b/scripts/mksysmap
--- a/scripts/mksysmap 2004-08-13 21:09:21 +02:00
+++ b/scripts/mksysmap 2004-08-13 21:09:21 +02:00
@@ -18,7 +18,7 @@
# they are used by the sparc BTFIXUP logic - and is assumed to be undefined.


-if [ "`$NM -u $1 | grep -v ' ____'`" != "" ]; then
+if [ "`$NM -u $1 | grep -v ' ___'`" != "" ]; then
echo "$1: error: undefined symbol(s) found:"
$NM -u $1 | grep -v ' ___'
exit 1
-
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/