#!/bin/bash # nmdiff BIN1 BIN2 - compare two binaries by symbol size # 13apr2016 +chris+ support Go programs with whitespace in indentifiers # 13apr2016 +chris+ show missing/new symbols nmsize() { nm -S -t d "$1" | sed 's/^[^ ]* //; /^[^0]/d; s/ /\t/; s/ /\t/' } join -t' ' -a1 -a2 -j3 -e0 -o0,1.1,1.2,2.1,2.2 <(nmsize "$1") <(nmsize "$2") | awk 'BEGIN { FS=OFS="\t" } { $1 = substr($1, 1, 60); $6 = $2 - $4; if ($6 != 0) print }' | sort -n -k 6 | column -t -s ' '