diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/mksysmap | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/mksysmap b/scripts/mksysmap new file mode 100644 index 000000000000..0915b9ecc2bb --- /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 |
