nm -a -m $1

S="$(size -x -m -l $1)"

parse() (
    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")
)

parse __data: "DATA SECTION"
parse __bss: "BSS SECTION"
parse __common: "COMMON SECTION"
