e7042a740e
Discovered after removing implicit jni.h include path. Bug: 152482542 Test: lunch aosp_x86_64 && m checkbuild Change-Id: I5fcb33b110c8f5ee9db3c910eaaa3e6018979a45
24 lines
633 B
C++
24 lines
633 B
C++
#include <android/dlext.h>
|
|
#include <dlfcn.h>
|
|
#include <stdlib.h>
|
|
|
|
extern "C" void text_before_start_of_gap() {}
|
|
char end_of_gap[0x1000];
|
|
|
|
extern "C" void* get_inner() {
|
|
android_dlextinfo info = {};
|
|
info.flags = ANDROID_DLEXT_RESERVED_ADDRESS;
|
|
|
|
char* start_of_gap =
|
|
reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(text_before_start_of_gap) & ~0xfffull) +
|
|
0x1000;
|
|
info.reserved_addr = start_of_gap;
|
|
info.reserved_size = end_of_gap - start_of_gap;
|
|
|
|
void *handle = android_dlopen_ext("libsegment_gap_inner.so", RTLD_NOW, &info);
|
|
if (!handle) {
|
|
__builtin_trap();
|
|
}
|
|
|
|
return dlsym(handle, "inner");
|
|
}
|