+ script also includes the common data section

contributed by Lars Rasmusson @ SICS
This commit is contained in:
fros4943 2010-01-20 16:38:55 +00:00
parent 41142c4836
commit 5470cb5bc3

View File

@ -1,23 +1,17 @@
#!/bin/bash
nm -a -m $1 nm -a -m $1
DATA_START=`size -x -m -l $1 | grep "Section __data: 0x" | awk '{print $5}'` S="$(size -x -m -l $1)"
echo DATA SECTION START: $DATA_START
DATA_SIZE=`size -x -m -l $1 | grep "Section __data: 0x" | awk '{print $3}'` parse() (
echo DATA SECTION SIZE: $DATA_SIZE echo "$S" |
awk '/^Segment/ {s=$2} s=="__DATA:" && $2=="'$1'" \
{printf "%s %s 0x%x\n",$5,$3,$3+$5}' |
(read start size end;
echo "$2 START: $start";
echo "$2 SIZE: $size";
echo "$2 END: $end")
)
DATA_END=` echo $(($DATA_START+$DATA_SIZE)) | awk '{printf("0x%x", $0)}' ` parse __data: "DATA SECTION"
echo DATA SECTION END: $DATA_END parse __bss: "BSS SECTION"
parse __common: "COMMON SECTION"
BSS_START=$DATA_END
echo BSS SECTION START: $BSS_START
#TOTAL_SIZE=`size -x -m -l $1 | grep -m 1 -A 10000 "Segment __DATA" | grep -m 1 -B 10000 "total 0x" | grep total | awk '{print $2}'`
#echo TOTAL SECTION SIZE: $TOTAL_SIZE
TOTAL_SIZE=`size -x -m -l $1 | grep "Segment __DATA: 0x" | awk '{print $3}'`
echo TOTAL SECTION SIZE: $TOTAL_SIZE
echo BSS SECTION END: ` echo $(($DATA_START+$TOTAL_SIZE)) | awk '{printf("0x%x", $0)}' `