From a738f6d0361dcf116b60e021a7f7e85d57a52161 Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Fri, 13 Oct 2023 09:26:51 +0000 Subject: [PATCH] Restrict memory-analyzer build to Linux x86_64/i386 We do not currently have an implementation of calling conventions for any other platform. Fixes: #7934 --- CMakeLists.txt | 4 +++- regression/Makefile | 19 ++++++++++--------- src/CMakeLists.txt | 2 +- src/Makefile | 18 ++++++++++++------ unit/Makefile | 19 ++++++++++--------- 5 files changed, 36 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26c87cd1b1e..bed1ee334b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,7 +199,9 @@ function(cprover_default_properties) XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${CBMC_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}) endfunction() -if(CMAKE_SYSTEM_NAME STREQUAL Linux) +if(CMAKE_SYSTEM_NAME STREQUAL Linux AND + (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR + CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")) set(WITH_MEMORY_ANALYZER_DEFAULT ON) else() set(WITH_MEMORY_ANALYZER_DEFAULT OFF) diff --git a/regression/Makefile b/regression/Makefile index 59a92ce5516..7a8732ac264 100644 --- a/regression/Makefile +++ b/regression/Makefile @@ -66,16 +66,17 @@ DIRS = cbmc-shadow-memory \ book-examples \ # Empty last line -ifeq ($(OS),Windows_NT) - detected_OS := Windows -else +ifndef WITH_MEMORY_ANALYZER + ifeq ($(OS),Windows_NT) + WITH_MEMORY_ANALYZER = 0 + else detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown') -endif - -ifeq ($(detected_OS),Linux) - ifneq ($(WITH_MEMORY_ANALYZER),0) - # only set if it wasn't explicitly unset - WITH_MEMORY_ANALYZER=1 + detected_ARCH := $(shell sh -c 'uname -m 2>/dev/null || echo Unknown') + ifeq ($(filter-out Linux_x86_64 Linux_i386,$(detected_OS)_$(detected_ARCH)),) + WITH_MEMORY_ANALYZER = 1 + else + WITH_MEMORY_ANALYZER = 0 + endif endif endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 09aa3763180..c5cf6eb697a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -122,6 +122,6 @@ add_subdirectory(symtab2gb) add_subdirectory(libcprover-cpp) add_subdirectory(goto-bmc) -if((NOT WIN32 AND NOT APPLE) OR WITH_MEMORY_ANALYZER) +if(WITH_MEMORY_ANALYZER) add_subdirectory(memory-analyzer) endif() diff --git a/src/Makefile b/src/Makefile index 3721f1f9109..c5b377c9c0d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -46,16 +46,22 @@ all: cbmc.dir \ symtab2gb.dir \ # Empty last line -ifeq ($(OS),Windows_NT) - detected_OS := Windows -else - detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown') +ifndef WITH_MEMORY_ANALYZER + ifeq ($(OS),Windows_NT) + WITH_MEMORY_ANALYZER = 0 + else + detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown') + detected_ARCH := $(shell sh -c 'uname -m 2>/dev/null || echo Unknown') + ifeq ($(filter-out Linux_x86_64 Linux_i386,$(detected_OS)_$(detected_ARCH)),) + WITH_MEMORY_ANALYZER = 1 + else + WITH_MEMORY_ANALYZER = 0 + endif + endif endif ifeq ($(WITH_MEMORY_ANALYZER),1) all: memory-analyzer.dir -else ifneq ($(filter-out Windows Darwin,$(detected_OS)),) - all: memory-analyzer.dir endif ############################################################################### diff --git a/unit/Makefile b/unit/Makefile index d2cc89d1045..208c3bc3a36 100644 --- a/unit/Makefile +++ b/unit/Makefile @@ -201,16 +201,17 @@ SRC += analyses/ai/ai.cpp \ util/xml.cpp \ # Empty last line -ifeq ($(OS),Windows_NT) - detected_OS := Windows -else +ifndef WITH_MEMORY_ANALYZER + ifeq ($(OS),Windows_NT) + WITH_MEMORY_ANALYZER = 0 + else detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown') -endif - -ifeq ($(detected_OS),Linux) - ifneq ($(WITH_MEMORY_ANALYZER),0) - # only set if it wasn't explicitly unset - WITH_MEMORY_ANALYZER=1 + detected_ARCH := $(shell sh -c 'uname -m 2>/dev/null || echo Unknown') + ifeq ($(filter-out Linux_x86_64 Linux_i386,$(detected_OS)_$(detected_ARCH)),) + WITH_MEMORY_ANALYZER = 1 + else + WITH_MEMORY_ANALYZER = 0 + endif endif endif