[PATCH] D148742: [BOLT] Make BOLT_ENABLE_RUNTIME user-configurable

Nathan Sidwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 11:42:13 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG06b8057cc285: [BOLT] Make BOLT_ENABLE_RUNTIME user-configurable (authored by urnathan).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148742/new/

https://reviews.llvm.org/D148742

Files:
  bolt/CMakeLists.txt


Index: bolt/CMakeLists.txt
===================================================================
--- bolt/CMakeLists.txt
+++ bolt/CMakeLists.txt
@@ -4,10 +4,23 @@
 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 \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148742.515412.patch
Type: text/x-patch
Size: 1079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230420/261ab891/attachment.bin>


More information about the llvm-commits mailing list