corda/sgx-jvm/jvm-enclave/enclave/gen-stubsyms.sh
2017-03-24 18:23:04 +00:00

28 lines
601 B
Bash
Executable File

#!/usr/bin/env bash
# Pipe the output of make when stubsyms.cpp is empty to this script:
#
# sgx-experiments/enclave$ make 2>&1 | ../enclave/gen-stubsyms.sh
workdir=`pwd`/../enclave
o=$workdir/stubsyms.cpp
grep "undefined reference to" | tr -d "'"'`' | grep -o '[^ ]*$' | sort | uniq >$workdir/stubsyms.txt
cat <<EOF >$o
// Generated by gen-stubsyms.sh
extern "C" {
extern void debug_print(const char *str);
extern void abort();
#define STUB(x) void x() { debug_print(#x); abort(); }
EOF
cat $workdir/stubsyms.txt | while read; do
echo "STUB($REPLY)" >>$o
done
echo "} // extern C" >>$o