[compiler-rt] Make SANITIZER_MIN_OSX_VERSION a cache variable (PR #74394)
Chris Apple via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 18 14:10:15 PST 2023
https://github.com/cjappl updated https://github.com/llvm/llvm-project/pull/74394
>From 938ea992b1ab6171c54c9c1707fd12092c116e15 Mon Sep 17 00:00:00 2001
From: Chris Apple <14171107+cjappl at users.noreply.github.com>
Date: Mon, 4 Dec 2023 15:40:24 -0800
Subject: [PATCH 1/3] Make SANITIZER_MIN_OSX_VERSION a cache variable
---
compiler-rt/cmake/config-ix.cmake | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 2dccd4954b2537..358c1d4bc62f17 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -463,25 +463,32 @@ if(APPLE)
# Note: In order to target x86_64h on OS X the minimum deployment target must
# be 10.8 or higher.
+ set(SANITIZER_MIN_OSX_VERSION "" CACHE STRING
+ "Minimum OS X version to target (e.g. 10.10) for sanitizers.")
+
set(DEFAULT_SANITIZER_MIN_OSX_VERSION 10.10)
set(DARWIN_osx_MIN_VER_FLAG "-mmacosx-version-min")
- if(NOT SANITIZER_MIN_OSX_VERSION)
+ if(SANITIZER_MIN_OSX_VERSION STREQUAL "")
string(REGEX MATCH "${DARWIN_osx_MIN_VER_FLAG}=([.0-9]+)"
MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")
if(MACOSX_VERSION_MIN_FLAG)
- set(SANITIZER_MIN_OSX_VERSION "${CMAKE_MATCH_1}")
+ set(MIN_OSX_VERSION "${CMAKE_MATCH_1}")
elseif(CMAKE_OSX_DEPLOYMENT_TARGET)
- set(SANITIZER_MIN_OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})
+ set(MIN_OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})
else()
- set(SANITIZER_MIN_OSX_VERSION ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
+ set(MIN_OSX_VERSION ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
endif()
- if(SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.7")
+
+ if(MIN_OSX_VERSION VERSION_LESS "10.7")
message(FATAL_ERROR "macOS deployment target '${SANITIZER_MIN_OSX_VERSION}' is too old.")
endif()
- if(SANITIZER_MIN_OSX_VERSION VERSION_GREATER ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
+ if(MIN_OSX_VERSION VERSION_GREATER ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
message(WARNING "macOS deployment target '${SANITIZER_MIN_OSX_VERSION}' is too new, setting to '${DEFAULT_SANITIZER_MIN_OSX_VERSION}' instead.")
- set(SANITIZER_MIN_OSX_VERSION ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
+ set(MIN_OSX_VERSION ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
endif()
+
+ set(SANITIZER_MIN_OSX_VERSION "${MIN_OSX_VERSION}" CACHE STRING
+ "Minimum OS X version to target (e.g. 10.10) for sanitizers." FORCE)
endif()
# We're setting the flag manually for each target OS
>From 96afdbd6855c67ad15772cbada7b84b8bb7c580b Mon Sep 17 00:00:00 2001
From: Chris Apple <14171107+cjappl at users.noreply.github.com>
Date: Mon, 18 Dec 2023 14:05:13 -0800
Subject: [PATCH 2/3] Setting OSX version after the block if it is not defined
---
compiler-rt/cmake/config-ix.cmake | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 358c1d4bc62f17..ffe4b9850d07ef 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -468,7 +468,7 @@ if(APPLE)
set(DEFAULT_SANITIZER_MIN_OSX_VERSION 10.10)
set(DARWIN_osx_MIN_VER_FLAG "-mmacosx-version-min")
- if(SANITIZER_MIN_OSX_VERSION STREQUAL "")
+ if(NOT SANITIZER_MIN_OSX_VERSION)
string(REGEX MATCH "${DARWIN_osx_MIN_VER_FLAG}=([.0-9]+)"
MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")
if(MACOSX_VERSION_MIN_FLAG)
@@ -479,6 +479,8 @@ if(APPLE)
set(MIN_OSX_VERSION ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
endif()
+ # Note: In order to target x86_64h on OS X the minimum deployment target must
+ # be 10.8 or higher.
if(MIN_OSX_VERSION VERSION_LESS "10.7")
message(FATAL_ERROR "macOS deployment target '${SANITIZER_MIN_OSX_VERSION}' is too old.")
endif()
@@ -488,7 +490,7 @@ if(APPLE)
endif()
set(SANITIZER_MIN_OSX_VERSION "${MIN_OSX_VERSION}" CACHE STRING
- "Minimum OS X version to target (e.g. 10.10) for sanitizers." FORCE)
+ "Minimum OS X version to target (e.g. 10.10) for sanitizers.")
endif()
# We're setting the flag manually for each target OS
>From 60eebf6c40fc75918ce6d7b15160b6014822becf Mon Sep 17 00:00:00 2001
From: Chris Apple <14171107+cjappl at users.noreply.github.com>
Date: Mon, 18 Dec 2023 14:10:03 -0800
Subject: [PATCH 3/3] Get rid of rebase cruft
---
compiler-rt/cmake/config-ix.cmake | 5 -----
1 file changed, 5 deletions(-)
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index ffe4b9850d07ef..fa97411dbe5af5 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -461,11 +461,6 @@ if(APPLE)
set(ORC_SUPPORTED_OS osx)
endif()
- # Note: In order to target x86_64h on OS X the minimum deployment target must
- # be 10.8 or higher.
- set(SANITIZER_MIN_OSX_VERSION "" CACHE STRING
- "Minimum OS X version to target (e.g. 10.10) for sanitizers.")
-
set(DEFAULT_SANITIZER_MIN_OSX_VERSION 10.10)
set(DARWIN_osx_MIN_VER_FLAG "-mmacosx-version-min")
if(NOT SANITIZER_MIN_OSX_VERSION)
More information about the llvm-commits
mailing list