Skip to content

Commit 87e9c42

Browse files
[BOLT][Instrumentation] AArch64 instrumentation support in runtime
This commit adds support for AArch64 in instrumentation runtime library, including AArch64 system calls. Also this commit divides syscalls into target-specific files. Reviewed By: rafauler, yota9 Differential Revision: https://reviews.llvm.org/D151942
1 parent 70405a0 commit 87e9c42

File tree

6 files changed

+852
-395
lines changed

6 files changed

+852
-395
lines changed

bolt/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ foreach (tgt ${BOLT_TARGETS_TO_BUILD})
3232
endforeach()
3333

3434
set(BOLT_ENABLE_RUNTIME_default OFF)
35-
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
35+
if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
36+
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
3637
AND (CMAKE_SYSTEM_NAME STREQUAL "Linux"
37-
OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
38-
AND "X86" IN_LIST BOLT_TARGETS_TO_BUILD)
38+
OR CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
3939
set(BOLT_ENABLE_RUNTIME_default ON)
4040
endif()
4141
option(BOLT_ENABLE_RUNTIME "Enable BOLT runtime" ${BOLT_ENABLE_RUNTIME_default})

bolt/runtime/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ set(BOLT_RT_FLAGS
2727
-fno-exceptions
2828
-fno-rtti
2929
-fno-stack-protector
30-
-mno-sse
31-
-fPIC)
30+
-fPIC
31+
-mgeneral-regs-only)
32+
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
33+
set(BOLT_RT_FLAGS ${BOLT_RT_FLAGS} "-mno-sse")
34+
endif()
3235

3336
# Don't let the compiler think it can create calls to standard libs
3437
target_compile_options(bolt_rt_instr PRIVATE ${BOLT_RT_FLAGS})
@@ -39,7 +42,7 @@ target_include_directories(bolt_rt_hugify PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
3942
install(TARGETS bolt_rt_instr DESTINATION "lib${LLVM_LIBDIR_SUFFIX}")
4043
install(TARGETS bolt_rt_hugify DESTINATION "lib${LLVM_LIBDIR_SUFFIX}")
4144

42-
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
45+
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*" AND CMAKE_SYSTEM_NAME STREQUAL "Darwin")
4346
add_library(bolt_rt_instr_osx STATIC
4447
instr.cpp
4548
${CMAKE_CURRENT_BINARY_DIR}/config.h

0 commit comments

Comments
 (0)