blob: 6e133a0bae7a8db162a5233fbf4af319f5ede35f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#!/bin/sh -x
2# Based on the vmlinux file create the System.map file
3# System.map is used by module-init tools and some debugging
Adrian Bunk943ffb52006-01-10 00:10:13 +01004# tools to retrieve the actual addresses of symbols in the kernel.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#
6# Usage
7# mksysmap vmlinux System.map
8
9
10#####
11# Generate System.map (actual filename passed as second argument)
12
13# $NM produces the following output:
14# f0081e80 T alloc_vfsmnt
15
16# The second row specify the type of the symbol:
17# A = Absolute
18# B = Uninitialised data (.bss)
19# C = Comon symbol
20# D = Initialised data
21# G = Initialised data for small objects
22# I = Indirect reference to another symbol
23# N = Debugging symbol
24# R = Read only
25# S = Uninitialised data for small objects
26# T = Text code symbol
27# U = Undefined symbol
28# V = Weak symbol
29# W = Weak symbol
30# Corresponding small letters are local symbols
31
32# For System.map filter away:
33# a - local absolute symbols
34# U - undefined global symbols
Sam Ravnborgaab34ac2008-05-19 20:07:58 +020035# N - debugging symbols
Linus Torvalds1da177e2005-04-16 15:20:36 -070036# w - local weak symbols
37
38# readprofile starts reading symbols when _stext is found, and
39# continue until it finds a symbol which is not either of 'T', 't',
40# 'W' or 'w'. __crc_ are 'A' and placed in the middle
41# so we just ignore them to let readprofile continue to work.
42# (At least sparc64 has __crc_ in the middle).
43
Sam Ravnborgaab34ac2008-05-19 20:07:58 +020044$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2
Linus Torvalds1da177e2005-04-16 15:20:36 -070045