Files
upx/src/stub/scripts/setfold.sh
T
Markus F.X.J. Oberhumer aba09d07c9 Make it compile again by adding a more portable setfold.sh script.
committer: mfx <mfx> 962038500 +0000
2000-06-26 16:55:00 +00:00

24 lines
431 B
Bash

#!/bin/sh
set -e
file="$1"
# get directory of this script
bindir=`echo "$0" | sed -e 's|[^/][^/]*$||'`
bindir=`cd "$bindir" && pwd`
sstrip="$bindir/../util/sstrip/sstrip"
# get address of symbol "fold_begin"
fold=`nm -f bsd "$file" | grep fold_begin | sed 's/^0*\([0-9a-fA-F]*\).*/0x\1/'`
# strip
objcopy -S -R .comment -R .note "$file"
"$sstrip" "$file"
# patch address
perl -w "$bindir/setfold.pl" "$file" "$fold"
exit 0