Index: bolt/CMakeLists.txt =================================================================== --- bolt/CMakeLists.txt +++ bolt/CMakeLists.txt @@ -44,6 +44,8 @@ endif() endif() +option(BOLT_RT_MAX_MEM "Maximum memory for runtime allocations." 0xa00000) + if (BOLT_ENABLE_RUNTIME) message(STATUS "Building BOLT runtime libraries for X86") ExternalProject_Add(bolt_rt @@ -55,7 +57,8 @@ -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_INSTALL_PREFIX=${LLVM_BINARY_DIR} - BUILD_ALWAYS True + -DBOLT_RT_MAX_MEM=${BOLT_RT_MAX_MEM} + BUILD_ALWAYS True ) install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins/cmake_install.cmake \)" COMPONENT bolt) Index: bolt/runtime/CMakeLists.txt =================================================================== --- bolt/runtime/CMakeLists.txt +++ bolt/runtime/CMakeLists.txt @@ -14,6 +14,9 @@ instr.cpp ${CMAKE_CURRENT_BINARY_DIR}/config.h ) +option(BOLT_RT_MAX_MEM "Maximum memory for runtime allocations.") +target_compile_definitions(bolt_rt_instr PRIVATE RUNTIME_MAX_MEMORY=${BOLT_RT_MAX_MEM}) + add_library(bolt_rt_hugify STATIC hugify.cpp ${CMAKE_CURRENT_BINARY_DIR}/config.h Index: bolt/runtime/instr.cpp =================================================================== --- bolt/runtime/instr.cpp +++ bolt/runtime/instr.cpp @@ -206,7 +206,7 @@ private: static constexpr uint64_t Magic = 0x1122334455667788ull; - uint64_t MaxSize = 0xa00000; + uint64_t MaxSize = RUNTIME_MAX_MEMORY; uint8_t *StackBase{nullptr}; uint64_t StackSize{0}; bool Shared{false};