diff --git a/core/build.gradle.kts b/core/build.gradle.kts index a4304d05..d5aa9dda 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -99,16 +99,14 @@ android { "-D__FILE__=__FILE_NAME__", "-DRIRU_MODULE", "-DRIRU_MODULE_API_VERSION=$moduleMaxRiruApiVersion", - """-DMODULE_NAME=\"$riruModuleId\"""" -// "-DRIRU_MODULE_VERSION=$verCode", // this will stop ccache from hitting -// """-DRIRU_MODULE_VERSION_NAME=\"$verName\"""", + """-DMODULE_NAME=\"$riruModuleId\"""", ) cppFlags("-std=c++20", *flags) cFlags("-std=c18", *flags) arguments( "-DANDROID_STL=none", "-DVERSION_CODE=$verCode", - "-DVERSION_NAME=$verName" + "-DVERSION_NAME=$verName", ) targets("lspd") } diff --git a/core/src/main/cpp/CMakeLists.txt b/core/src/main/cpp/CMakeLists.txt index 919a5eab..3eb0fa0d 100644 --- a/core/src/main/cpp/CMakeLists.txt +++ b/core/src/main/cpp/CMakeLists.txt @@ -18,6 +18,7 @@ ## Copyright (C) 2021 LSPosed Contributors ## +project(libcxx) cmake_minimum_required(VERSION 3.4.1) find_program(CCACHE ccache) diff --git a/core/src/main/cpp/main/src/context.cpp b/core/src/main/cpp/main/src/context.cpp index 8e9c2b2e..3189034c 100644 --- a/core/src/main/cpp/main/src/context.cpp +++ b/core/src/main/cpp/main/src/context.cpp @@ -231,6 +231,7 @@ namespace lspd { } else { auto context = Context::ReleaseInstance(); auto service = Service::ReleaseInstance(); + art_img.reset(); LOGD("skipped %s", process_name.get()); setAllowUnload(true); } diff --git a/core/src/main/cpp/main/src/elf_util.h b/core/src/main/cpp/main/src/elf_util.h index e1f5c5b6..24387f05 100644 --- a/core/src/main/cpp/main/src/elf_util.h +++ b/core/src/main/cpp/main/src/elf_util.h @@ -58,6 +58,10 @@ namespace SandHook { return base != nullptr; } + const std::string name() const { + return elf; + } + ~ElfImg(); private: diff --git a/core/src/main/cpp/main/src/native_hook.cpp b/core/src/main/cpp/main/src/native_hook.cpp index b654d33b..d54c0aea 100644 --- a/core/src/main/cpp/main/src/native_hook.cpp +++ b/core/src/main/cpp/main/src/native_hook.cpp @@ -47,7 +47,7 @@ namespace lspd { return; } LOGD("Start to install inline hooks"); - SandHook::ElfImg &handle_libart = *art_img; + const auto &handle_libart = *art_img; if (!handle_libart.isValid()) { LOGE("Failed to fetch libart.so"); } diff --git a/core/src/main/cpp/main/src/symbol_cache.cpp b/core/src/main/cpp/main/src/symbol_cache.cpp index d9c79d00..577bbf20 100644 --- a/core/src/main/cpp/main/src/symbol_cache.cpp +++ b/core/src/main/cpp/main/src/symbol_cache.cpp @@ -39,7 +39,7 @@ namespace lspd { void *sym_openDexFileNative = nullptr; void *sym_setTrusted = nullptr; void *sym_set_table_override = nullptr; - std::unique_ptr art_img = nullptr; + std::unique_ptr art_img = nullptr; bool findLibArt() { art_img = std::make_unique(kLibArtName); diff --git a/core/src/main/cpp/main/src/symbol_cache.h b/core/src/main/cpp/main/src/symbol_cache.h index 1aa97eff..d3ed209e 100644 --- a/core/src/main/cpp/main/src/symbol_cache.h +++ b/core/src/main/cpp/main/src/symbol_cache.h @@ -32,7 +32,7 @@ namespace SandHook { namespace lspd { extern bool sym_initialized; - extern std::unique_ptr art_img; + extern std::unique_ptr art_img; extern void *sym_do_dlopen; extern void *sym_openInMemoryDexFilesNative; extern void *sym_createCookieWithArray;