mirror of
https://github.com/geode-sdk/geode.git
synced 2024-12-14 10:01:20 -05:00
36 lines
846 B
C++
36 lines
846 B
C++
#include "dobby.h"
|
|
|
|
#include "bionic_linker_restriction.h"
|
|
|
|
#include "logging/logging.h"
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#define LOG_TAG "AndroidLinkerRestriction"
|
|
|
|
__attribute__((constructor)) static void ctor() {
|
|
const char *lib = NULL;
|
|
|
|
#if defined(__LP64__)
|
|
lib = "/system/lib64/libandroid_runtime.so";
|
|
#else
|
|
lib = "/system/lib/libandroid_runtime.so";
|
|
#endif
|
|
|
|
void *vm = NULL;
|
|
|
|
vm = DobbySymbolResolver(lib, "_ZN7android14AndroidRuntime7mJavaVME");
|
|
LOG(1, "DobbySymbolResolver::vm %p", vm);
|
|
|
|
#if 0
|
|
linker_disable_namespace_restriction();
|
|
void *handle = NULL;
|
|
handle = dlopen(lib, RTLD_LAZY);
|
|
vm = dlsym(handle, "_ZN7android14AndroidRuntime7mJavaVME");
|
|
#else
|
|
void *handle = NULL;
|
|
handle = linker_dlopen(lib, RTLD_LAZY);
|
|
vm = dlsym(handle, "_ZN7android14AndroidRuntime7mJavaVME");
|
|
#endif
|
|
LOG(1, "vm %p", vm);
|
|
}
|