This repository was archived by the owner on Nov 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 11#include < android/dlext.h>
22#include < dlfcn.h>
33#include < stdlib.h>
4+ #include < unistd.h>
45
56extern " C" void __attribute__ ((section(" .custom_text" ))) text_before_start_of_gap() {}
67char __attribute__ ((section(" .custom_bss" ))) end_of_gap[0x1000];
@@ -10,8 +11,9 @@ extern "C" void* get_inner() {
1011 info.flags = ANDROID_DLEXT_RESERVED_ADDRESS;
1112
1213 char * start_of_gap =
13- reinterpret_cast <char *>(reinterpret_cast <uintptr_t >(text_before_start_of_gap) & ~0xfffull ) +
14- 0x1000 ;
14+ reinterpret_cast <char *>(
15+ (reinterpret_cast <uintptr_t >(text_before_start_of_gap) &
16+ ~(sysconf (_SC_PAGESIZE) - 1 )) + sysconf (_SC_PAGESIZE));
1517 info.reserved_addr = start_of_gap;
1618 info.reserved_size = end_of_gap - start_of_gap;
1719
Original file line number Diff line number Diff line change @@ -3,17 +3,17 @@ SECTIONS {
33 # appropriate alignment between them.
44 . = SIZEOF_HEADERS ;
55 .rodata : {* (.rodata .rodata.* )}
6- . = ALIGN (0x1000 );
6+ . = ALIGN (CONSTANT (MAXPAGESIZE) );
77 .text : {* (.text .text.* )}
8- . = ALIGN (0x1000 );
8+ . = ALIGN (CONSTANT (MAXPAGESIZE) );
99 .dynamic : {* (.dynamic )}
10- . = ALIGN (0x1000 );
10+ . = ALIGN (CONSTANT (MAXPAGESIZE) );
1111 .data : {* (.data .data.* )}
1212 .bss : {* (.bss .bss.* )}
1313
1414 # Now create the gap. We need a text segment first to prevent the linker from
1515 # merging .bss with .custom_bss .
16- . = ALIGN (0x1000 );
16+ . = ALIGN (CONSTANT (MAXPAGESIZE) );
1717 .custom_text : {
1818 *(.custom_text );
1919 }
You can’t perform that action at this time.
0 commit comments