From: Ben Gras Date: Thu, 3 Jan 2013 21:32:14 +0000 (+0000) Subject: unstack: add shared libraries symbols X-Git-Tag: v3.2.1~146 X-Git-Url: http://zhaoyanbai.com/repos/dnssec-keygen.html?a=commitdiff_plain;h=73d95c770ffb2898cbe1f4ea197dcc622a563c40;p=minix.git unstack: add shared libraries symbols --- diff --git a/commands/unstack/unstack.sh b/commands/unstack/unstack.sh index 118913216..c7ea41a4c 100644 --- a/commands/unstack/unstack.sh +++ b/commands/unstack/unstack.sh @@ -48,7 +48,17 @@ fi SYMLIST=/tmp/unstack.$$ # store sorted, filtered nm output once -( $NM $executable ; $EXTRANM ) | sed 's/^/0x/' | sort -x | grep ' [Tt] [^.]' >$SYMLIST +( +$NM $executable | sed 's/^/0x/' +$EXTRANM + +# Add shared libraries +ldd -f"%p %x\n" $executable 2>/dev/null | while read lib addr +do echo >&2 "Adding $lib at $addr" + nm -n $lib | sed 's/^/0x/' | grep ' [Tt] ' | \ +gawk -v liboffset=$addr -v libname=$lib --non-decimal-data '{ printf "0x%lx %s %s[%s]\n", $1+liboffset, $2, $3, libname }' +done +) | sort -x | grep ' [Tt] [^.]' >$SYMLIST while [ $# -gt 0 ] do gawk <$SYMLIST --non-decimal-data -v symoffset=$1 '