diff --git a/elfconvert.sh b/elfconvert.sh index 206835c..6e30e72 100755 --- a/elfconvert.sh +++ b/elfconvert.sh @@ -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 ;;