xref: /OK3568_Linux_fs/device/rockchip/common/linux-kbuild/armhf/linux-kbuild-4.4/scripts/makelst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#!/bin/sh
2*4882a593Smuzhiyun# A script to dump mixed source code & assembly
3*4882a593Smuzhiyun# with correct relocations from System.map
4*4882a593Smuzhiyun# Requires the following lines in makefile:
5*4882a593Smuzhiyun#%.lst: %.c
6*4882a593Smuzhiyun#	$(CC) $(c_flags) -g -c -o $*.o $< &&
7*4882a593Smuzhiyun#	$(srctree)/scripts/makelst $*.o System.map $(OBJDUMP) > $@
8*4882a593Smuzhiyun#
9*4882a593Smuzhiyun# Copyright (C) 2000 IBM Corporation
10*4882a593Smuzhiyun# Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
11*4882a593Smuzhiyun#            William Stearns <wstearns@pobox.com>
12*4882a593Smuzhiyun#
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun# awk style field access
15*4882a593Smuzhiyunfield() {
16*4882a593Smuzhiyun  shift $1 ; echo $1
17*4882a593Smuzhiyun}
18*4882a593Smuzhiyun
19*4882a593Smuzhiyunt1=`$3 --syms $1 | grep .text | grep -m1 " F "`
20*4882a593Smuzhiyunif [ -n "$t1" ]; then
21*4882a593Smuzhiyun  t2=`field 6 $t1`
22*4882a593Smuzhiyun  if [ ! -r $2 ]; then
23*4882a593Smuzhiyun    echo "No System.map" >&2
24*4882a593Smuzhiyun  else
25*4882a593Smuzhiyun    t3=`grep $t2 $2`
26*4882a593Smuzhiyun    t4=`field 1 $t3`
27*4882a593Smuzhiyun    t5=`field 1 $t1`
28*4882a593Smuzhiyun    t6=`printf "%lu" $((0x$t4 - 0x$t5))`
29*4882a593Smuzhiyun  fi
30*4882a593Smuzhiyunfi
31*4882a593Smuzhiyun$3 -r --source --adjust-vma=${t6:-0} $1
32