aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
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 /scripts
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 'scripts')
-rw-r--r--scripts/mksysmap54
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/mksysmap b/scripts/mksysmap
new file mode 100644
index 00000000000000..0915b9ecc2bbfe
--- /dev/null
+++ b/scripts/mksysmap
@@ -0,0 +1,54 @@
+#!/bin/sh -x
+# Based on the vmlinux file create the System.map file
+# System.map is used by module-init tools and some debugging
+# tools to retreive the actual addresses of symbols in the kernel.
+#
+# Before creating the System.map file as a sideeffect check for
+# undefined symbols.
+# At least one version of the ARM bin-utils did not error out on
+# undefined symbols, so catch them here instead.
+
+# Usage
+# mksysmap vmlinux System.map
+
+
+#####
+# Check for undefined symbols.
+# Undefined symbols with three leading underscores are ignored since
+# they are used by the sparc BTFIXUP logic - and is assumed to be undefined.
+
+
+if [ "`$NM -u $1 | grep -v ' ____'`" != "" ]; then
+ echo "$1: error: undefined symbol(s) found:"
+ $NM -u $1 | grep -v ' ___'
+ exit 1
+fi
+
+#####
+# Generate System.map (actual filename passed as second argument)
+
+# $NM produces the following output:
+# f0081e80 T alloc_vfsmnt
+
+# The second row specify the type of the symbol:
+# A = Absolute
+# B = Uninitialised data (.bss)
+# C = Comon symbol
+# D = Initialised data
+# G = Initialised data for small objects
+# I = Indirect reference to another symbol
+# N = Debugging symbol
+# R = Read only
+# S = Uninitialised data for small objects
+# T = Text code symbol
+# U = Undefined symbol
+# V = Weak symbol
+# W = Weak symbol
+# Corresponding small letters are local symbols
+
+# For System.map filter away:
+# a - local absolute symbols
+# U - undefined global symbols
+# w - local weak symbols
+
+nm $1 | grep -v ' [aUw] ' > $2