diff --git a/elfconvert.sh b/elfconvert.sh index 206835c..410f38b 100755 --- a/elfconvert.sh +++ b/elfconvert.sh @@ -11,7 +11,7 @@ case $SAR_ARGV0 in *) sbcl_subdir=k8 esac sbcl=$RUNFILES/google3/third_party/lisp/sbcl/binary-distribution/$sbcl_subdir/bin/sbcl -args=(--noinform --dynamic-space-size 512MB) +args=(--noinform --dynamic-space-size 1GB) mode='(setq *evaluator-mode* :compile)' script=$RUNFILES/google3/third_party/lisp/sbcl/src/tools-for-build/elftool @@ -19,10 +19,20 @@ action=$1 input=$2 output=$3 +compactcore=/tmp/compact-$$.core +tmpcore=/tmp/patched-$$.core +DSS=16384 + case $action in split) - exec $sbcl ${args[@]} --eval "$mode" --load $script --eval \ - '(sb-editcore:split-core "'$input'" "'$output'")' --quit ;; + exec $sbcl ${args[@]} --eval "$mode" --load $script \ + --eval '(sb-editcore:reorganize-core "'$input'" "'$compactcore'")' \ + --eval '(sb-editcore:move-dynamic-code-to-text-space "'$compactcore'" "'$tmpcore'")' \ + --eval '(delete-file "'$compactcore'")' \ + --eval '(sb-editcore:redirect-text-space-calls "'$tmpcore'")' \ + --eval '(sb-editcore:split-core "'$tmpcore'" "'$output'" :dynamic-space-size '$DSS')' \ + --eval '(delete-file "'$tmpcore'")' --quit ;; + copy) exec $sbcl ${args[@]} --eval "$mode" --load $script --eval \ '(sb-editcore::copy-to-elf-obj "'$input'" "'$output'")' --quit ;;