aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2004-08-08 01:35:44 +0200
committerSam Ravnborg <sam@mars.ravnborg.org>2004-08-08 01:35:44 +0200
commit1d3fa84da087f3ca352a3f8a8c39b7c7ec14f68d (patch)
tree55e15977dbccadd41a2f02cf06bc667e345ca815 /Makefile
parente7bf20316397771071fead8fa59169a9ce90d804 (diff)
downloadhistory-1d3fa84da087f3ca352a3f8a8c39b7c7ec14f68d.tar.gz
kbuild: Check for undefined symbols in vmlinux
At least one bin-utils version for ARM is know to ignore undefined symbols when performing the final link of vmlinux. Add an explicit check for undefined symbols to catch this. The check is made in combination with generating the System.map file and the actual algorithm is moved to a small shell script - mksysmap. External symbols with three leading underscores are ignored - sparc uses them for the BTFIXUP logic. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 18 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 33a27b57b73fe4..8006683febadc3 100644
--- a/Makefile
+++ b/Makefile
@@ -538,8 +538,9 @@ define rule_vmlinux__
echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
endef
-do_system_map = $(NM) $(1) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(2)
-
+quiet_cmd_sysmap = SYSMAP
+ cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
+
LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds.s
# Generate section listing all symbols and add it into vmlinux
@@ -570,8 +571,10 @@ endif
kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
define rule_verify_kallsyms
- @$(call do_system_map, .tmp_vmlinux$(last_kallsyms), .tmp_System.map)
- @cmp -s System.map .tmp_System.map || \
+ $(Q)$(if $($(quiet)cmd_sysmap), \
+ echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \
+ $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map
+ $(Q)cmp -s System.map .tmp_System.map || \
(echo Inconsistent kallsyms data, try setting CONFIG_KALLSYMS_EXTRA_PASS ; rm .tmp_kallsyms* ; false)
endef
@@ -595,11 +598,19 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--al
endif
-# Finally the vmlinux rule
+# Finally the vmlinux rule
+# This rule is also used to generate System.map
+# and to verify that the content of kallsyms are consistent
define rule_vmlinux
- $(rule_vmlinux__); \
- $(call do_system_map, $@, System.map)
+ $(rule_vmlinux__);
+ $(Q)$(if $($(quiet)cmd_sysmap), \
+ echo ' $($(quiet)cmd_sysmap) $@' &&) \
+ $(cmd_sysmap) $@ System.map; \
+ if [ $$? -ne 0 ]; then \
+ rm -f $@; \
+ /bin/false; \
+ fi;
$(rule_verify_kallsyms)
endef