summaryrefslogtreecommitdiff
path: root/platform/efi/efi_resolver/CMakeLists.txt
diff options
context:
space:
mode:
authorZichuan Li <34680029+river-li@users.noreply.github.com>2024-08-15 11:53:05 -0400
committerBrandon Miller <brandon@vector35.com>2025-05-08 07:23:08 -0400
commit7f08117cfeb48a8f48d08e14cb498ee028efcef2 (patch)
tree345eab220c00cfa098e94fa261dce092fc8d5182 /platform/efi/efi_resolver/CMakeLists.txt
parent64de95854f9ad4da90b9cf2ee69a80f5dddd7a18 (diff)
Move EFI Resolver to API
Support all existing features in EFI Resolver, 1. Doesn't support running on existing BNDBs (though we tried to support this in python plugins, it doesn't work well) 2. Perform analysis on MLIL rather than HLIL, previous pattern matching on HLIL constains many false negatives
Diffstat (limited to 'platform/efi/efi_resolver/CMakeLists.txt')
-rw-r--r--platform/efi/efi_resolver/CMakeLists.txt47
1 files changed, 47 insertions, 0 deletions
diff --git a/platform/efi/efi_resolver/CMakeLists.txt b/platform/efi/efi_resolver/CMakeLists.txt
new file mode 100644
index 00000000..03fabbf6
--- /dev/null
+++ b/platform/efi/efi_resolver/CMakeLists.txt
@@ -0,0 +1,47 @@
+cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
+
+project(efi_resolver)
+
+option(DEBUG "DEBUG Mode" ON)
+
+if((NOT BN_API_PATH) AND (NOT BN_INTERNAL_BUILD))
+ set(BN_API_PATH $ENV{BN_API_PATH})
+ if(NOT BN_API_PATH)
+ message(FATAL_ERROR "Provide path to Binary Ninja API source in BN_API_PATH")
+ endif()
+endif()
+if(NOT BN_INTERNAL_BUILD)
+ set(HEADLESS ON CACHE BOOL "")
+ add_subdirectory(${BN_API_PATH} ${PROJECT_BINARY_DIR}/api)
+endif()
+
+# Binary Ninja plugin ----------------------------------------------------------
+
+file(
+ GLOB_RECURSE SOURCE_FILES
+ CONFIGURE_DEPENDS # Automatically reconfigure if source files are added/removed.
+ ${PROJECT_SOURCE_DIR}/src/*.cpp ${PROJECT_SOURCE_DIR}/include/*.h
+)
+
+add_library(efi_resolver SHARED ${SOURCE_FILES})
+target_link_libraries(efi_resolver binaryninjaapi)
+target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
+target_compile_features(efi_resolver PRIVATE cxx_std_17 c_std_99)
+
+# Library targets linking against the Binary Ninja API need to be compiled with
+# position-independent code on Linux.
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+ target_compile_options(efi_resolver PRIVATE "-fPIC")
+endif()
+
+# Configure plugin output directory for internal builds, otherwise configure
+# plugin installation for public builds.
+
+if(BN_INTERNAL_BUILD)
+ set_target_properties(efi_resolver PROPERTIES
+ LIBRARY_OUTPUT_DIRECTORY ${BN_CORE_PLUGIN_DIR}
+ RUNTIME_OUTPUT_DIRECTORY ${BN_CORE_PLUGIN_DIR})
+else()
+ bn_install_plugin(${PROJECT_NAME})
+endif()
+