about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2020-12-03 11:43:02 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-12-04 21:05:57 +0000
commit199bd43deffc614b2915f4de26475ca43d22e2ae (patch)
tree395276ea008407f9902eb0e0817b7df5f1020c31
parentf9b7c9032db07ba2d811c3bf16a100cc3adfc67e (diff)
downloadklee-199bd43deffc614b2915f4de26475ca43d22e2ae.tar.gz
Only build 32bit runtime libraries if supported by platform
Automatically detect if 32bit bitcode files can be built.
In this case, build runtime library with 32bit as well.
-rw-r--r--CMakeLists.txt8
-rw-r--r--runtime/CMakeLists.txt6
2 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba1e221b..3427a6bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -486,6 +486,14 @@ set_property(CACHE
   PROPERTY STRINGS ${available_klee_runtime_build_types})
 message(STATUS "KLEE_RUNTIME_BUILD_TYPE: ${KLEE_RUNTIME_BUILD_TYPE}")
 
+# Check availability of 32bit support for platform
+include(CheckCSourceRuns)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_FLAGS "-m32")
+check_c_source_runs("int main(int argc, char** argv){return 0;}" M32_SUPPORTED)
+cmake_pop_check_state()
+message(STATUS "32bit platform supported: ${M32_SUPPORTED}")
+
 set(KLEE_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/klee/runtime")
 
 # Location where KLEE will look for the built runtimes by default.
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index ea8335de..54521f8b 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -11,8 +11,12 @@ add_subdirectory(Runtest)
 
 # Handle bitcode libraries
 # Define the different configurations to be compiled and made available using a specific suffix
+set(bc_architectures 64)
 
-set(bc_architectures 32 64)
+# Compile 32bit support if available
+if (M32_SUPPORTED)
+    list(APPEND bc_architectures "32")
+endif ()
 
 set(LIB_BC_SUFFIX "")