Print this page
new smatch

@@ -27,28 +27,35 @@
                 SPARSEOPTS="$SPARSEOPTS $1 " ;;
         esac
         shift
 done
 
-TMPLLVM=`mktemp -t tmp.XXXXXX`".llvm"
-TMPFILE=`mktemp -t tmp.XXXXXX`".o"
+TMPFILE=`mktemp -t tmp.XXXXXX`
 
-$DIRNAME/sparse-llvm $SPARSEOPTS > $TMPLLVM
 
 LLC=`"${LLVM_CONFIG:-llvm-config}" --bindir`/llc
 
-$LLC -o - $TMPLLVM | as -o $TMPFILE
+LLC_ARCH_OPTS=
+case "$(uname -s)" in
+*CYGWIN*)
+        # cygwin uses the sjlj (setjmp-longjmp) exception model
+        LLC_ARCH_OPTS="-exception-model=sjlj"
+        ;;
+*)
+        ;;
+esac
 
+$DIRNAME/sparse-llvm $SPARSEOPTS | $LLC ${LLC_ARCH_OPTS} | as -o $TMPFILE
+
 if [ $NEED_LINK -eq 1 ]; then
         if [ -z $OUTFILE ]; then
                 OUTFILE=a.out
         fi
         gcc $TMPFILE -o $OUTFILE
+        rm -f $TMPFILE
 else
         if [ -z $OUTFILE ]; then
                 echo "`basename $0`: no output file"
                 exit 1
         fi
         mv $TMPFILE $OUTFILE
 fi
-
-rm -f $TMPLLVM