bionic: libdl_cfi: Remove PAGE_SIZE usage
Use max_page_size() for build time variable alignments instead of PAGE_SIZE. In the 4k targets there is no functional difference since max_page_size() == page_size() == 4096. On a 16kb device max_page_size() == 65536 and page_size() == 16384. However, aligning up does not incur any memory regressions since the .bss/.data sections are still be backed in PAGE_SIZE'ed chunks. See: go/16k-page-aligned-variables Bug: 296275298 Test: mma Change-Id: Ic944235d8a5742a51a8fb0f2a0b75e532f404110 Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
parent
0398f8ab3a
commit
461c64db9e
1 changed files with 3 additions and 3 deletions
|
@ -26,15 +26,15 @@ __attribute__((__weak__, visibility("default"))) extern "C" void __loader_cfi_fa
|
|||
// dlopen/dlclose.
|
||||
static struct {
|
||||
uintptr_t v;
|
||||
char padding[PAGE_SIZE - sizeof(v)];
|
||||
} shadow_base_storage alignas(PAGE_SIZE);
|
||||
char padding[max_page_size() - sizeof(v)];
|
||||
} shadow_base_storage alignas(max_page_size());
|
||||
|
||||
// __cfi_init is called by the loader as soon as the shadow is mapped. This may happen very early
|
||||
// during startup, before libdl.so global constructors, and, on i386, even before __libc_sysinfo is
|
||||
// initialized. This function should not do any system calls.
|
||||
extern "C" uintptr_t* __cfi_init(uintptr_t shadow_base) {
|
||||
shadow_base_storage.v = shadow_base;
|
||||
static_assert(sizeof(shadow_base_storage) == PAGE_SIZE, "");
|
||||
static_assert(sizeof(shadow_base_storage) == max_page_size(), "");
|
||||
return &shadow_base_storage.v;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue