6cd00fa61d7ff1686c89c1069d804f061a8a66ad
1 #!/bin/bash
2 # Simple script to extract addresses from a linker command file and
3 # reformat for input into a second linker command file
4 #
5 # usage: symExtract <input file> <output file> symbol1 [symbol2 ...]
6 #
9 if [ $# -lt 3 ]; then
10 echo usage: $0 \<input file\> \<output file\> symbol1 \[symbol2 ...\]
11 exit
12 fi
14 args=("$@")
16 rm -f $2
18 echo "/* File autogenerated by symExtract during build process. Do not edit */" > $2
21 carg=2
22 while [ $carg -lt $# ]; do
23 symbol=`cat $1 | sed -n /${args[$carg]}\$/p | sed -n 1p`
24 addr=`echo $symbol | sed -e s/\ .*//`
25 sym=`echo $symbol | sed -e s/^.*\ //`
26 echo $sym=0x$addr\; >> $2
27 let carg=carg+1
28 done