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 15t1=`$3 --syms $2/$1.o | grep .text | grep " F " | head -n 1` 16t2=`echo $t1 | gawk '{ print $6 }'` 17t3=`grep $t2 $2/System.map` 18t4=`echo $t3 | gawk '{ print $1 }'` 19t5=`echo $t1 | gawk '{ print $1 }'` 20t6=`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` 21t7=`( echo ibase=16 ; echo $t6 ) | bc` 22$3 --source --adjust-vma=$t7 $2/$1.o > $2/$1.lst 23