From 5bf72277906b877ccfed53816646daf8e70f76df Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 8 Dec 2024 15:13:15 +1000 Subject: [PATCH] CPU/CodeCache: Use code buffer section on Android --- src/core/cpu_code_cache.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/cpu_code_cache.cpp b/src/core/cpu_code_cache.cpp index 31c1ac411..fe0878eaf 100644 --- a/src/core/cpu_code_cache.cpp +++ b/src/core/cpu_code_cache.cpp @@ -130,10 +130,11 @@ static constexpr u32 RECOMPILER_CODE_CACHE_SIZE = 48 * 1024 * 1024; static constexpr u32 RECOMPILER_FAR_CODE_CACHE_SIZE = 16 * 1024 * 1024; #endif -// On Linux ARM32/ARM64, we use a dedicated section in the ELF for storing code. -// This is because without ASLR, or on certain ASLR offsets, the sbrk() heap ends up immediately following the text/data -// sections, which means there isn't a large enough gap to fit within range on ARM32. -#if defined(__linux__) && (defined(CPU_ARCH_ARM32) || defined(CPU_ARCH_ARM64)) +// On Linux ARM32/ARM64, we use a dedicated section in the ELF for storing code. This is because without +// ASLR, or on certain ASLR offsets, the sbrk() heap ends up immediately following the text/data sections, +// which means there isn't a large enough gap to fit within range on ARM32. Also enable it for Android, +// because MAP_FIXED_NOREPLACE may not exist on older kernels. +#if (defined(__linux__) && (defined(CPU_ARCH_ARM32) || defined(CPU_ARCH_ARM64))) || defined(__ANDROID__) #define USE_CODE_BUFFER_SECTION 1 #ifdef __clang__ #pragma clang section bss = ".jitstorage"