summaryrefslogtreecommitdiff
path: root/bolt
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2023-04-19 16:08:25 -0400
committerNathan Sidwell <nathan@acm.org>2023-04-20 14:41:32 -0400
commit06b8057cc285cd7567ed7aaf57875227b3ec53da (patch)
tree04fa2c7b1cfbf0ee74bcf2bf134a1fe9b346b553 /bolt
parent01910787d386584ea5a3d5dc317a908423ba39ed (diff)
downloadllvm-06b8057cc285cd7567ed7aaf57875227b3ec53da.tar.gz
[BOLT] Make BOLT_ENABLE_RUNTIME user-configurable
Defaults to ON for x86_64 && (Linux | Darwin). If enabled, checks that /proc/self/map_files is readable. Some systems are configured so that getdents fails with EPERM. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D148742
Diffstat (limited to 'bolt')
-rw-r--r--bolt/CMakeLists.txt17
1 files changed, 15 insertions, 2 deletions
diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt
index 650cac8094dc..01ed186510c8 100644
--- a/bolt/CMakeLists.txt
+++ b/bolt/CMakeLists.txt
@@ -4,10 +4,23 @@ set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(BOLT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_CXX_STANDARD 17)
-set(BOLT_ENABLE_RUNTIME OFF)
+set(BOLT_ENABLE_RUNTIME_default OFF)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
+ AND (CMAKE_SYSTEM_NAME STREQUAL "Linux"
+ OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
AND "X86" IN_LIST LLVM_TARGETS_TO_BUILD)
- set(BOLT_ENABLE_RUNTIME ON)
+ set(BOLT_ENABLE_RUNTIME_default ON)
+endif()
+option(BOLT_ENABLE_RUNTIME "Enable BOLT runtime" ${BOLT_ENABLE_RUNTIME_default})
+if (BOLT_ENABLE_RUNTIME)
+ # Some systems prevent reading /proc/self/map_files
+ execute_process(COMMAND ls /proc/self/map_files
+ RESULT_VARIABLE LS OUTPUT_QUIET ERROR_QUIET)
+ if (LS)
+ set(BOLT_ENABLE_RUNTIME OFF)
+ message(WARNING
+ "BOLT runtime is disabled as /proc/self/map_files is unreadable.")
+ endif()
endif()
set(BOLT_CLANG_EXE "" CACHE FILEPATH "Path to clang executable for the target \