diff options
author | Stephane Glondu <steph@glondu.net> | 2010-07-21 09:46:51 +0200 |
---|---|---|
committer | Stephane Glondu <steph@glondu.net> | 2010-07-21 09:46:51 +0200 |
commit | 5b7eafd0f00a16d78f99a27f5c7d5a0de77dc7e6 (patch) | |
tree | 631ad791a7685edafeb1fb2e8faeedc8379318ae /dev/ocamlopt_shared_os5fix.sh | |
parent | da178a880e3ace820b41d38b191d3785b82991f5 (diff) |
Imported Upstream snapshot 8.3~beta0+13298
Diffstat (limited to 'dev/ocamlopt_shared_os5fix.sh')
-rwxr-xr-x | dev/ocamlopt_shared_os5fix.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/dev/ocamlopt_shared_os5fix.sh b/dev/ocamlopt_shared_os5fix.sh new file mode 100755 index 00000000..f7d31ad8 --- /dev/null +++ b/dev/ocamlopt_shared_os5fix.sh @@ -0,0 +1,29 @@ +#/bin/sh + +### Temporary fix for production of .cmxs on MacOS 10.5 + +OCAMLOPT=$1 +CMXS=$2 + +DIR=`dirname $CMXS` +BASE=`basename $CMXS .cmxs` +CMXA=$DIR/$BASE.cmxa +ARC=$DIR/$BASE.a +# we assume that all object files are at the same place than the rest +OBJS=`ar t $ARC | sed -e "s|^|$DIR/|" | grep -v SYMDEF` + +$OCAMLOPT -dstartup -linkall -shared -o $CMXS $CMXA +# Fix1: add a dummy instruction before the caml generic functions +# Fix2: make all caml generic functions private +rm -f $CMXS $CMXS.startup.fixed.s +cat $CMXS.startup.s | sed \ + -e "s/_caml_shared_startup__code_begin:/_caml_shared_startup__code_begin: ret/" \ + -e "s/.globl _caml_curry/.private_extern _caml_curry/" \ + -e "s/.globl _caml_apply/.private_extern _caml_apply/" \ + -e "s/.globl _caml_tuplify/.private_extern _caml_tuplify/" \ + > $CMXS.startup.fixed.s +# Recompile fixed startup code +as -o $CMXS.startup.o $CMXS.startup.fixed.s +# Build fixed .cmxs (assume all object files are at the same place) +ld -bundle -flat_namespace -undefined warning -read_only_relocs suppress -o $CMXS $OBJS $CMXS.startup.o +rm $CMXS.startup.o $CMXS.startup.s $CMXS.startup.fixed.s
\ No newline at end of file |