Skip to content

Commit bb053e3

Browse files
authored
Do not use pagezero size option if osx version >= 13 (#3025)
Reported in #3009.
1 parent 705bf80 commit bb053e3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

build-scripts/config_common.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,13 @@ else ()
464464
endif ()
465465

466466
if (APPLE)
467+
EXEC_PROGRAM(sw_vers ARGS -productVersion OUTPUT_VARIABLE OS_X_VERSION)
468+
STRING(REGEX MATCH "([0-9]+)" OS_X_VERSION ${OS_X_VERSION})
469+
if (OS_X_VERSION LESS 13)
470+
set(PAGE_ZERO_SIZE_OPTION "-Wl,-pagezero_size,0x4000")
471+
endif ()
472+
467473
# On recent macOS versions, by default, the size of page zero is 4GB.
468474
# Shrink it to make MAP_32BIT mmap can work.
469-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-pagezero_size,0x4000")
475+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PAGE_ZERO_SIZE_OPTION}")
470476
endif ()

0 commit comments

Comments
 (0)