2017-05-23 07:35:23 -06:00
|
|
|
fixupOutputHooks+=(_cygwinFixAutoImageBase)
|
2015-05-26 07:18:49 -06:00
|
|
|
|
|
|
|
_cygwinFixAutoImageBase() {
|
2017-05-23 07:35:23 -06:00
|
|
|
if [ "$dontRebase" == 1 ] || [ ! -d "$prefix" ]; then
|
2016-05-20 09:17:10 -06:00
|
|
|
return
|
|
|
|
fi
|
2017-05-23 07:35:23 -06:00
|
|
|
find "$prefix" -name "*.dll" -type f | while read DLL; do
|
2015-05-26 07:18:49 -06:00
|
|
|
if [ -f /etc/rebasenix.nextbase ]; then
|
|
|
|
NEXTBASE="$(</etc/rebasenix.nextbase)"
|
|
|
|
fi
|
|
|
|
NEXTBASE=${NEXTBASE:-0x62000000}
|
|
|
|
|
|
|
|
REBASE=(`/bin/rebase -i $DLL`)
|
|
|
|
BASE=${REBASE[2]}
|
|
|
|
SIZE=${REBASE[4]}
|
|
|
|
SKIP=$(((($SIZE>>16)+1)<<16))
|
|
|
|
|
|
|
|
echo "REBASE FIX: $DLL $BASE -> $NEXTBASE"
|
|
|
|
/bin/rebase -b $NEXTBASE $DLL
|
|
|
|
NEXTBASE="0x`printf %x $(($NEXTBASE+$SKIP))`"
|
|
|
|
|
|
|
|
echo $NEXTBASE > /etc/rebasenix.nextbase
|
|
|
|
done
|
|
|
|
}
|