From 79673d8f6fa23e63b925058b063836f00e970ab6 Mon Sep 17 00:00:00 2001 From: "shifu.wu" Date: Mon, 12 May 2025 17:02:43 +0800 Subject: [PATCH] feat: Add support for the maximum page size of 16 KB for Android (only on the arm64 and x86_64 platforms). --- super_native_extensions/rust/build.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/super_native_extensions/rust/build.rs b/super_native_extensions/rust/build.rs index 0007fcd1..66afef10 100644 --- a/super_native_extensions/rust/build.rs +++ b/super_native_extensions/rust/build.rs @@ -3,6 +3,8 @@ mod gen_keyboard_map; fn main() { let target_system = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); + let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap(); + // keyboard map is currently only supported on desktop. match target_system.as_str() { "macos" | "linux" | "windows" => { @@ -10,4 +12,10 @@ fn main() { } _ => {} } + + // Add support for the maximum page size of 16 KB for Android (only on the arm64 and x86_64 platforms). + // see: https://developer.android.com/guide/practices/page-sizes#other-build-systems + if target_system == "android" && (target_arch == "aarch64" || target_arch == "x86_64") { + println!("cargo:rustc-link-arg=-Wl,-z,max-page-size=16384"); + } }