Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion build-scripts/config_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,13 @@ else ()
endif ()

if (APPLE)
EXEC_PROGRAM(sw_vers ARGS -productVersion OUTPUT_VARIABLE OS_X_VERSION)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we should check cmake target instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STRING(REGEX MATCH "([0-9]+)" OS_X_VERSION ${OS_X_VERSION})
if (OS_X_VERSION LESS 13)
set(PAGE_ZERO_SIZE_OPTION "-Wl,-pagezero_size,0x4000")
endif ()

# On recent macOS versions, by default, the size of page zero is 4GB.
# Shrink it to make MAP_32BIT mmap can work.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-pagezero_size,0x4000")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PAGE_ZERO_SIZE_OPTION}")
endif ()