import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / scripts / makelst
1 #!/bin/bash
2 # A script to dump mixed source code & assembly
3 # with correct relocations from System.map
4 # Requires the following lines in Rules.make.
5 # Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 
6 #            William Stearns <wstearns@pobox.com>
7 #%.lst: %.c
8 #       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $<
9 #       $(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP)
10 #
11 #    Copyright (C) 2000 IBM Corporation
12 #    Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 
13 #
14
15 t1=`$3 --syms $2/$1.o | grep .text | grep " F " | head -n 1`
16 t2=`echo $t1 | gawk '{ print $6 }'`
17 t3=`grep $t2 $2/System.map`
18 t4=`echo $t3 | gawk '{ print $1 }'`
19 t5=`echo $t1 | gawk '{ print $1 }'`
20 t6=`echo $t4 - $t5 | sed -e s/a/A/g -e s/b/B/g -e s/c/C/g -e s/d/D/g -e s/e/E/g -e s/f/F/g`
21 t7=`( echo  ibase=16 ; echo $t6 ) | bc`
22 $3 --source --adjust-vma=$t7 $2/$1.o > $2/$1.lst