CPU/CodeCache: Use code buffer section on Android

This commit is contained in:
Stenzek 2024-12-08 15:13:15 +10:00
parent 1adf36ccb2
commit 5bf7227790
No known key found for this signature in database
1 changed files with 5 additions and 4 deletions

View File

@ -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; static constexpr u32 RECOMPILER_FAR_CODE_CACHE_SIZE = 16 * 1024 * 1024;
#endif #endif
// On Linux ARM32/ARM64, we use a dedicated section in the ELF for storing code. // On Linux ARM32/ARM64, we use a dedicated section in the ELF for storing code. This is because without
// This is because without ASLR, or on certain ASLR offsets, the sbrk() heap ends up immediately following the text/data // ASLR, or on certain ASLR offsets, the sbrk() heap ends up immediately following the text/data sections,
// sections, which means there isn't a large enough gap to fit within range on ARM32. // which means there isn't a large enough gap to fit within range on ARM32. Also enable it for Android,
#if defined(__linux__) && (defined(CPU_ARCH_ARM32) || defined(CPU_ARCH_ARM64)) // 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 #define USE_CODE_BUFFER_SECTION 1
#ifdef __clang__ #ifdef __clang__
#pragma clang section bss = ".jitstorage" #pragma clang section bss = ".jitstorage"