From 8ed46a0c186cd14fbb1e609cb4da0c23fa31fa87 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Tue, 6 Apr 2021 14:32:36 +0800 Subject: [PATCH] [core] No more PIE --- core/build.gradle.kts | 14 +++++--------- core/src/main/cpp/dynamic_list | 3 --- core/src/main/cpp/main/CMakeLists.txt | 7 ++----- core/src/main/cpp/main/src/main.cpp | 3 --- 4 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 core/src/main/cpp/dynamic_list diff --git a/core/build.gradle.kts b/core/build.gradle.kts index f8e62c13..512063be 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -97,8 +97,8 @@ android { "-fno-rtti", "-fno-exceptions", "-fno-stack-protector", "-fomit-frame-pointer", - "-fpie", "-fPIC", "-Wno-builtin-macro-redefined", + "-Wl,--exclude-libs,ALL", "-D__FILE__=__FILE_NAME__", "-DRIRU_MODULE", "-DRIRU_MODULE_API_VERSION=$moduleMaxRiruApiVersion", @@ -298,26 +298,22 @@ afterEvaluate { ) } copy { - include("lspd") - rename("lspd", "liblspd.so") + include("liblspd.so") from("$libPathRelease/armeabi-v7a") into("$zipPathMagiskReleasePath/riru/lib") } copy { - include("lspd") - rename("lspd", "liblspd.so") + include("liblspd.so") from("$libPathRelease/arm64-v8a") into("$zipPathMagiskReleasePath/riru/lib64") } copy { - include("lspd") - rename("lspd", "liblspd.so") + include("liblspd.so") from("$libPathRelease/x86") into("$zipPathMagiskReleasePath/riru_x86/lib") } copy { - include("lspd") - rename("lspd", "liblspd.so") + include("liblspd.so") from("$libPathRelease/x86_64") into("$zipPathMagiskReleasePath/riru_x86/lib64") } diff --git a/core/src/main/cpp/dynamic_list b/core/src/main/cpp/dynamic_list deleted file mode 100644 index 5b4815d5..00000000 --- a/core/src/main/cpp/dynamic_list +++ /dev/null @@ -1,3 +0,0 @@ -{ -init; -}; \ No newline at end of file diff --git a/core/src/main/cpp/main/CMakeLists.txt b/core/src/main/cpp/main/CMakeLists.txt index eebc9821..e344da81 100644 --- a/core/src/main/cpp/main/CMakeLists.txt +++ b/core/src/main/cpp/main/CMakeLists.txt @@ -26,14 +26,11 @@ aux_source_directory(src SRC_LIST) aux_source_directory(src/jni SRC_JNI_LIST) include_directories(include src) -add_executable(lspd ${SRC_LIST} ${SRC_JNI_LIST} ${CMAKE_CURRENT_BINARY_DIR}/src/config.cpp) - -SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--dynamic-list=${CMAKE_SOURCE_DIR}/dynamic_list") +add_library(lspd SHARED ${SRC_LIST} ${SRC_JNI_LIST} ${CMAKE_CURRENT_BINARY_DIR}/src/config.cpp) find_package(riru REQUIRED CONFIG) find_library(log-lib log) target_link_libraries(lspd yahfa riru::riru android dobby dex_builder libcxx ${log-lib}) add_custom_command(TARGET lspd POST_BUILD - COMMAND ${CMAKE_STRIP} --remove-section=.preinit_array --remove-section=.comment - -g "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lspd") + COMMAND ${CMAKE_STRIP} --remove-section=.comment -g "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/liblspd.so") diff --git a/core/src/main/cpp/main/src/main.cpp b/core/src/main/cpp/main/src/main.cpp index b269a30e..3b5ad99c 100644 --- a/core/src/main/cpp/main/src/main.cpp +++ b/core/src/main/cpp/main/src/main.cpp @@ -126,6 +126,3 @@ RIRU_EXPORT RiruVersionedModuleInfo *init(Riru *riru) { lspd::allowUnload = riru->allowUnload; return &lspd::module; } - -int main() { -}