summaryrefslogtreecommitdiff
path: root/gcell/lib/runtime/gcell-embedspu-libtool
diff options
context:
space:
mode:
Diffstat (limited to 'gcell/lib/runtime/gcell-embedspu-libtool')
-rwxr-xr-xgcell/lib/runtime/gcell-embedspu-libtool40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcell/lib/runtime/gcell-embedspu-libtool b/gcell/lib/runtime/gcell-embedspu-libtool
new file mode 100755
index 0000000000..c206086a4c
--- /dev/null
+++ b/gcell/lib/runtime/gcell-embedspu-libtool
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# Take a spu executable and turn into into a libtool compatible .lo (and .o) file.
+# This is needed when you want to embed a SPU executable into a shared library.
+#
+# The symbol assigned to the embedded executable is the basename of the
+# output file with an _spx appended. E.g., if the output filename is
+# my_spe_tricks.lo the symbol name is my_spe_tricks_spx.
+# ("_spx" stands for SPE executable)
+
+if [ $# -ne 2 ]; then
+ echo "usage: gcell-embedspu-libtool spu_executable output_file.lo " 1>&2
+ exit 1
+fi
+
+spu_executable=$1
+lo_file=$2
+symbol_name=${lo_file%%.lo}_spx
+
+# try to make .libs in case it's not there
+mkdir .libs >/dev/null 2>/dev/null
+
+# generate the .o file that wraps the SPU executable
+ppu-embedspu -m32 -fpic ${symbol_name} ${spu_executable} .libs/${symbol_name}.o
+
+# generate the .lo libtool file that points at all the right places
+rm -f $lo_file
+cat >$lo_file.new <<EOF
+# $lo_file - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+pic_object='.libs/${symbol_name}.o'
+non_pic_object=none
+EOF
+
+mv $lo_file.new $lo_file
+