about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2014-10-09 19:37:55 +0100
committerDan Liew <daniel.liew@imperial.ac.uk>2014-10-09 20:13:08 +0100
commit10b800db2c0639399ca2bdc041959519c54f89e5 (patch)
treea3e4edf8ed4943e72484f2ebc0d471065009ecdc
parent492565b392831866fefef748917705a824f6f29f (diff)
downloadklee-10b800db2c0639399ca2bdc041959519c54f89e5.tar.gz
Add a hack for Travis so that llvm-gcc can build native executables.
This could be useful if KLEE tests want to use the bitcode compiler
as a native compiler.
-rwxr-xr-x.travis/install-llvm-and-runtime-compiler.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/.travis/install-llvm-and-runtime-compiler.sh b/.travis/install-llvm-and-runtime-compiler.sh
index 6374747e..6fba5baf 100755
--- a/.travis/install-llvm-and-runtime-compiler.sh
+++ b/.travis/install-llvm-and-runtime-compiler.sh
@@ -10,4 +10,19 @@ else
     wget http://llvm.org/releases/2.9/llvm-gcc4.2-2.9-x86_64-linux.tar.bz2
     tar -xjf llvm-gcc4.2-2.9-x86_64-linux.tar.bz2
     mv llvm-gcc4.2-2.9-x86_64-linux llvm-gcc
+
+    # Hack to make llvm-gcc capable of building a native executable
+    OLD_DIR=$(pwd)
+    cd llvm-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.2.1
+    ln -s /usr/lib/x86_64-linux-gnu/crt1.o
+    ln -s /usr/lib/x86_64-linux-gnu/crti.o
+    ln -s /usr/lib/x86_64-linux-gnu/crtn.o
+    cd "$OLD_DIR"
+
+    # Check it can compile hello world
+    echo -e "#include <stdio.h> \n int main(int argc, char** argv) { printf(\"Hello World\"); return 0;}" > test.c
+    export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
+    export CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
+    llvm-gcc/bin/llvm-gcc test.c -o hello_world
+    ./hello_world
 fi