Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0
0003 # A script to dump mixed source code & assembly
0004 # with correct relocations from System.map
0005 # Requires the following lines in makefile:
0006 #%.lst: %.c
0007 #       $(CC) $(c_flags) -g -c -o $*.o $< &&
0008 #       $(srctree)/scripts/makelst $*.o System.map $(OBJDUMP) > $@
0009 #
0010 # Copyright (C) 2000 IBM Corporation
0011 # Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
0012 #            William Stearns <wstearns@pobox.com>
0013 #
0014 
0015 # awk style field access
0016 field() {
0017   shift $1 ; echo $1
0018 }
0019 
0020 t1=`$3 --syms $1 | grep .text | grep -m1 " F "`
0021 if [ -n "$t1" ]; then
0022   t2=`field 6 $t1`
0023   if [ ! -r $2 ]; then
0024     echo "No System.map" >&2
0025   else
0026     t3=`grep $t2 $2`
0027     t4=`field 1 $t3`
0028     t5=`field 1 $t1`
0029     t6=`printf "%lu" $((0x$t4 - 0x$t5))`
0030   fi
0031 fi
0032 $3 -r --source --adjust-vma=${t6:-0} $1