From e321995244ccd5fb6af0c2cf63a65984c3fa1b86 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 7 Aug 2025 17:32:16 +0200 Subject: [PATCH] Support Google Play 16 KB Page Size Requirement (#13470) - See: https://developer.android.com/guide/practices/page-sizes#update-packaging - Also, make min API uniform at 21 (from 16 and 23 in a few places) Manual backport of dc2c83c3834f4eaa64698cc19cc80a3f21105e57 (cherry picked from commit 4b2aa3f102697b1ace7455c24c6c07f802c07476) --- Android.mk | 4 ++++ CMakeLists.txt | 3 +++ test/CMakeLists.txt | 1 + 3 files changed, 8 insertions(+) diff --git a/Android.mk b/Android.mk index 3ccbd44ca1..95dda5566a 100644 --- a/Android.mk +++ b/Android.mk @@ -88,6 +88,10 @@ ifeq ($(NDK_DEBUG),1) cmd-strip := endif +# https://developer.android.com/guide/practices/page-sizes +LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384" +LOCAL_LDFLAGS += "-Wl,-z,common-page-size=16384" + LOCAL_STATIC_LIBRARIES := cpufeatures include $(BUILD_SHARED_LIBRARY) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25d3236c7e..e0ffe5014c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1275,6 +1275,9 @@ if(ANDROID) set(HAVE_SDL_MISC TRUE) endif() + # https://developer.android.com/guide/practices/page-sizes + list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-z,max-page-size=16384" "-Wl,-z,common-page-size=16384") + # SDL_spinlock.c Needs to be compiled in ARM mode. # There seems to be no better way currently to set the ARM mode. # see: https://issuetracker.google.com/issues/62264618 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7cabbc3603..88f3ddb3df 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -40,6 +40,7 @@ macro(add_sdl_test_executable TARGET) list(APPEND SDLTEST_TARGETS ${TARGET}) if(ANDROID) add_library(${TARGET} SHARED ${AST_UNPARSED_ARGUMENTS}) + set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384") else() add_executable(${TARGET} ${AST_UNPARSED_ARGUMENTS}) endif()