mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 19:16:53 +00:00

This initial commit does not add any specific binary analyses yet, it merely contains the boilerplate to introduce a new BOLT-based tool. This basically combines the 4 first patches from the prototype pac-ret and stack-clash binary analyzer discussed in RFC https://discourse.llvm.org/t/rfc-bolt-based-binary-analysis-tool-to-verify-correctness-of-security-hardening/78148 and published at https://github.com/llvm/llvm-project/compare/main...kbeyls:llvm-project:bolt-gadget-scanner-prototype The introduction of such a BOLT-based binary analysis tool was proposed and discussed in at least the following places: - The RFC pointed to above - EuroLLVM 2024 round table https://discourse.llvm.org/t/summary-of-bolt-as-a-binary-analysis-tool-round-table-at-eurollvm/78441 The round table showed quite a few people interested in being able to build a custom binary analysis quickly with a tool like this. - Also at the US LLVM dev meeting a few weeks ago, I heard interest from a few people, asking when the tool would be available upstream. - The presentation "Adding Pointer Authentication ABI support for your ELF platform" (https://llvm.swoogo.com/2024devmtg/session/2512720/adding-pointer-authentication-abi-support-for-your-elf-platform) explicitly mentioned interest to extend the prototype tool to verify correct implementation of pauthabi.
73 lines
1.6 KiB
CMake
73 lines
1.6 KiB
CMake
llvm_canonicalize_cmake_booleans(
|
|
BOLT_ENABLE_RUNTIME
|
|
)
|
|
|
|
configure_lit_site_cfg(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
|
|
MAIN_CONFIG
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
|
|
)
|
|
configure_lit_site_cfg(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
|
|
MAIN_CONFIG
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
|
|
)
|
|
|
|
set(BOLT_TEST_PARAMS
|
|
bolt_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
)
|
|
|
|
if (BOLT_CLANG_EXE AND NOT "clang" IN_LIST LLVM_ENABLE_PROJECTS)
|
|
add_executable(clang IMPORTED GLOBAL)
|
|
set_property(TARGET clang PROPERTY IMPORTED_LOCATION "${BOLT_CLANG_EXE}")
|
|
endif()
|
|
|
|
if (BOLT_LLD_EXE AND NOT "lld" IN_LIST LLVM_ENABLE_PROJECTS)
|
|
add_executable(lld IMPORTED GLOBAL)
|
|
set_property(TARGET lld PROPERTY IMPORTED_LOCATION "${BOLT_LLD_EXE}")
|
|
endif()
|
|
|
|
list(APPEND BOLT_TEST_DEPS
|
|
clang
|
|
count
|
|
FileCheck
|
|
llc
|
|
lld
|
|
llvm-config
|
|
llvm-bolt
|
|
llvm-bolt-binary-analysis
|
|
llvm-bolt-heatmap
|
|
llvm-bat-dump
|
|
llvm-dwarfdump
|
|
llvm-dwp
|
|
llvm-mc
|
|
llvm-nm
|
|
llvm-objdump
|
|
llvm-readelf
|
|
llvm-readobj
|
|
llvm-strings
|
|
llvm-strip
|
|
llvm-objcopy
|
|
merge-fdata
|
|
not
|
|
split-file
|
|
yaml2obj
|
|
)
|
|
|
|
add_custom_target(bolt-test-depends DEPENDS ${BOLT_TEST_DEPS})
|
|
set_target_properties(bolt-test-depends PROPERTIES FOLDER "BOLT/Tests")
|
|
|
|
add_lit_testsuite(check-bolt "Running the BOLT regression tests"
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
PARAMS ${BOLT_TEST_PARAMS}
|
|
DEPENDS ${BOLT_TEST_DEPS}
|
|
ARGS ${BOLT_TEST_EXTRA_ARGS}
|
|
)
|
|
|
|
add_lit_testsuites(BOLT ${CMAKE_CURRENT_SOURCE_DIR}
|
|
PARAMS ${BOLT_TEST_PARAMS}
|
|
DEPENDS ${BOLT_TEST_DEPS}
|
|
)
|