| 1 |
From: YOKOTA Hiroshi <[email protected]> |
| 2 |
Date: Sat, 3 Aug 2024 02:25:34 +0900 |
| 3 |
Subject: Enable sanitizer option only for supported architecture (Closes: |
| 4 |
#1072992) |
| 5 |
|
| 6 |
Bug-Debian: https://bugs.debian.org/1072992 |
| 7 |
|
| 8 |
Some architectures dose not support sanitizer. |
| 9 |
--- |
| 10 |
src/test/CMakeLists.txt | 14 +++++++++++--- |
| 11 |
1 file changed, 11 insertions(+), 3 deletions(-) |
| 12 |
|
| 13 |
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt |
| 14 |
index afff2c4..e63c2a1 100644 |
| 15 |
--- a/src/test/CMakeLists.txt |
| 16 |
+++ b/src/test/CMakeLists.txt |
| 17 |
@@ -4,6 +4,7 @@ include(CMakePrintHelpers) |
| 18 |
enable_testing() |
| 19 |
|
| 20 |
cmake_print_variables(CMAKE_CXX_COMPILER_ID CMAKE_CXX_COMPILER_VERSION CMAKE_SIZEOF_VOID_P CMAKE_SYSTEM_PROCESSOR SSE) |
| 21 |
+cmake_print_variables(DEB_HOST_ARCH) |
| 22 |
|
| 23 |
# https://stackoverflow.com/questions/70475665/what-are-the-possible-values-of-cmake-system-processor |
| 24 |
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|i686") |
| 25 |
@@ -53,9 +54,16 @@ else() |
| 26 |
add_compile_options(-mstackrealign) |
| 27 |
endif() |
| 28 |
endif() |
| 29 |
- add_compile_options(-fsanitize=undefined -fsanitize=address) |
| 30 |
- add_link_options(-fsanitize=undefined -fsanitize=address) |
| 31 |
- link_libraries(-latomic) |
| 32 |
+ if (DEB_HOST_ARCH MATCHES "^(amd64|arm64|armel|armhf|i386|ppc64|ppc64el|riscv64|s390x|sparc64|x32)$") |
| 33 |
+ add_compile_options(-fsanitize=undefined) |
| 34 |
+ add_link_options(-fsanitize=undefined) |
| 35 |
+ link_libraries(-latomic) |
| 36 |
+ endif() |
| 37 |
+ if (DEB_HOST_ARCH MATCHES "^(amd64|arm64|armel|armhf|i386|ppc64|ppc64el|riscv64|s390x|x32)$") |
| 38 |
+ add_compile_options(-fsanitize=address) |
| 39 |
+ add_link_options(-fsanitize=address) |
| 40 |
+ link_libraries(-latomic) |
| 41 |
+ endif() |
| 42 |
endif() |
| 43 |
|
| 44 |
if (CMAKE_SIZEOF_VOID_P EQUAL 8) |