#!/bin/bash # Simple script to extract addresses from a linker command file and # reformat for input into a second linker command file # # usage: symExtract symbol1 [symbol2 ...] # if [ $# -lt 3 ]; then echo usage: $0 \ \ symbol1 \[symbol2 ...\] exit fi args=("$@") rm -f $2 echo "/* File autogenerated by symExtract during build process. Do not edit */" > $2 carg=2 while [ $carg -lt $# ]; do symbol=`cat $1 | sed -n /${args[$carg]}\$/p | sed -n 1p` addr=`echo $symbol | sed -e s/\ .*//` sym=`echo $symbol | sed -e s/^.*\ //` echo $sym=0x$addr\; >> $2 let carg=carg+1 done