Created
April 22, 2015 03:54
-
-
Save leeavital/d7f9d490eb4088a6bdc3 to your computer and use it in GitHub Desktop.
Debug build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
f=$1 | |
rm -f $f.*.s | |
rm -f $f.*.ll | |
echo "Building LL files" | |
./build/bin/mlton -codegen llvm -chunkify func -keep g $f.sml | |
# ./build/bin/mlton -codegen llvm -chunkify one -keep g -verbose 3 $f.sml | |
echo "done!" | |
# compile intermediate ll sources | |
for i in $(ls $f.*.ll) | |
do | |
sfile=$(echo $i | sed -e 's/\.ll$/\.s/') | |
ofile=$(echo $i | sed -e 's/\.ll/\.o/') | |
llc --o $sfile $i | |
echo "Building $sfile to $ofile" | |
as -o $ofile --gstabs $sfile | |
done | |
echo "Compiling C driver" | |
# compile the c driver | |
gcc -std=gnu99 -ggdb -c -I/usr/lib/mlton/targets/self/include \ | |
-I/usr/lib/mlton/include -O1 -fno-common -fno-strict-aliasing \ | |
-fomit-frame-pointer -w -m64 -o $f.0.o $f.0.c | |
echo "done!" | |
echo "Linking..." | |
echo $(ls $f.**.o) | |
gcc -o $f.debug $(ls $f.*.o) -ggdb \ | |
-L/usr/lib/mlton/targets/self -lmlton -lgdtoa -lm -lgmp -m64 \ | |
-Wl,-znoexecstack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment