about summary refs log tree commit diff homepage
path: root/runtime
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2018-05-27 10:26:43 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-10-26 13:31:07 +0100
commit0a7963e0dd119285b9730473ba417d181583ad0a (patch)
tree523088dae85f3cb34cd88ebc9213c8bc66d27d15 /runtime
parent1f1569510990a3330b6eb8e3499198294964a88e (diff)
downloadklee-0a7963e0dd119285b9730473ba417d181583ad0a.tar.gz
llvm5: test, add -disable-O0-optnone to -O0
Otherwise optimizations done in klee won't have any effect.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/CMakeLists.txt8
-rw-r--r--runtime/Makefile.cmake.bitcode.rules2
2 files changed, 8 insertions, 2 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index 61693afc..e3619f3d 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -91,13 +91,19 @@ ExternalProject_Add(BuildKLEERuntimes
   INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "" # Dummy command
 )
 
+set(O0OPT "-O0")
+if (${LLVM_VERSION_MAJOR} GREATER 4)
+	set(O0OPT "${O0OPT} -Xclang -disable-O0-optnone")
+endif()
+
+
 # Use `ExternalProject_Add_Step` with `ALWAYS` argument instead of directly
 # building in `ExternalProject_Add` with `BUILD_ALWAYS` argument due to lack of
 # support for the `BUILD_ALWAYS` argument in CMake < 3.1.
 ExternalProject_Add_Step(BuildKLEERuntimes RuntimeBuild
   # `env` is used here to make sure `MAKEFLAGS` of KLEE's build
   # is not propagated into the bitcode build system.
-  COMMAND ${ENV_BINARY} MAKEFLAGS="" ${MAKE_BINARY} -f Makefile.cmake.bitcode all
+  COMMAND ${ENV_BINARY} MAKEFLAGS="" O0OPT=${O0OPT} ${MAKE_BINARY} -f Makefile.cmake.bitcode all
   ALWAYS ${EXTERNAL_PROJECT_BUILD_ALWAYS_ARG}
   WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
   ${EXTERNAL_PROJECT_ADD_STEP_USES_TERMINAL_ARG}
diff --git a/runtime/Makefile.cmake.bitcode.rules b/runtime/Makefile.cmake.bitcode.rules
index 41b2814e..db731ac5 100644
--- a/runtime/Makefile.cmake.bitcode.rules
+++ b/runtime/Makefile.cmake.bitcode.rules
@@ -40,7 +40,7 @@ endif
 ifeq ($(IS_RELEASE),1)
 LLVMCC.Flags += -O2
 else
-LLVMCC.Flags += -O0
+LLVMCC.Flags += $(O0OPT)
 endif
 
 # Handle assertion flags