Refactored to new 3 stage system
This commit is contained in:
parent
d498e05935
commit
aa9fe3b8fc
@ -5,5 +5,7 @@ set(CMAKE_CXX_COMPILER g++-16 CACHE FILEPATH "C++ compiler" FORCE)
|
||||
|
||||
project(SelfPatchSLR LANGUAGES C CXX)
|
||||
|
||||
add_subdirectory(plugin)
|
||||
add_subdirectory(pinpoint)
|
||||
add_subdirectory(finalize)
|
||||
add_subdirectory(selfpatch)
|
||||
add_subdirectory(subject)
|
||||
|
||||
1
finalize/CMakeLists.txt
Normal file
1
finalize/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_executable(spslr_finalize finalize.cpp)
|
||||
5
finalize/finalize.cpp
Normal file
5
finalize/finalize.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::cout << "Hello World!" << std::endl;
|
||||
}
|
||||
9
pinpoint/CMakeLists.txt
Normal file
9
pinpoint/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
add_library(spslr_pinpoint SHARED pinpoint.cpp)
|
||||
|
||||
set_target_properties(spslr_pinpoint PROPERTIES PREFIX "")
|
||||
target_compile_definitions(spslr_pinpoint PRIVATE _GNU_SOURCE)
|
||||
target_compile_options(spslr_pinpoint PRIVATE -fno-rtti -fno-exceptions)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -print-file-name=plugin OUTPUT_VARIABLE GCC_PLUGIN_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "GCC plugin path: ${GCC_PLUGIN_PATH}")
|
||||
target_include_directories(spslr_pinpoint PRIVATE ${GCC_PLUGIN_PATH}/include ${CMAKE_CURRENT_SOURCE_DIR}/safegcc)
|
||||
16
pinpoint/pinpoint.cpp
Normal file
16
pinpoint/pinpoint.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <safe-gcc-plugin.h>
|
||||
#include <safe-plugin-version.h>
|
||||
|
||||
int plugin_is_GPL_compatible;
|
||||
|
||||
int plugin_init(struct plugin_name_args* plugin_info, struct plugin_gcc_version* version) {
|
||||
if (!plugin_default_version_check(version, &gcc_version)) {
|
||||
std::cerr << "spslr_pinpoint -> GCC version mismatch" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
6
pinpoint/safegcc/safe-gcc-plugin.h
Normal file
6
pinpoint/safegcc/safe-gcc-plugin.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef SAFEGCC_GCC_PLUGIN_H
|
||||
#define SAFEGCC_GCC_PLUGIN_H
|
||||
|
||||
#include <gcc-plugin.h>
|
||||
|
||||
#endif
|
||||
6
pinpoint/safegcc/safe-plugin-version.h
Normal file
6
pinpoint/safegcc/safe-plugin-version.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef SAFEGCC_PLUGIN_VERSION_H
|
||||
#define SAFEGCC_PLUGIN_VERSION_H
|
||||
|
||||
#include <plugin-version.h>
|
||||
|
||||
#endif
|
||||
6
selfpatch/CMakeLists.txt
Normal file
6
selfpatch/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
add_library(spslr_selfpatch STATIC src/selfpatch.cpp)
|
||||
|
||||
target_include_directories(spslr_selfpatch PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
0
selfpatch/src/selfpatch.cpp
Normal file
0
selfpatch/src/selfpatch.cpp
Normal file
@ -1,4 +1,4 @@
|
||||
add_executable(subject main.c)
|
||||
add_dependencies(subject selfpatch-slr)
|
||||
target_compile_options(subject PRIVATE -fplugin=$<TARGET_FILE:selfpatch-slr>
|
||||
-include ${CMAKE_CURRENT_SOURCE_DIR}/offsetof_passthrough.h)
|
||||
add_dependencies(subject spslr_pinpoint spslr_finalize spslr_selfpatch)
|
||||
target_link_libraries(subject PRIVATE spslr_selfpatch)
|
||||
target_compile_options(subject PRIVATE -fplugin=$<TARGET_FILE:spslr_pinpoint>)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user