Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Configuration for direct cargo builds (without cross)

# max-page-size=16384:
# Android 15 (API 35) introduces support for 16KB page sizes to improve performance on devices with larger RAM.
# Apps with native libraries MUST be compiled with 16KB ELF alignment or they will crash on startup
# on devices configured with 16KB page sizes. This flag ensures proper alignment for both 32-bit and 64-bit targets.
# Reference: https://developer.android.com/guide/practices/page-sizes
# common-page-size=4096:
# -z max-page-size=16384 is what makes the ELF safely load on 16 KB-page kernels. Bumping -z common-page-size to 16 KB doesn’t improve compatibility, but it does increase padding and memory waste on 4 KB devices.
[target.aarch64-linux-android]
rustflags = [
"-Clink-arg=-z",
"-Clink-arg=max-page-size=16384",
"-Clink-arg=-z",
"-Clink-arg=common-page-size=4096",
]

[target.armv7-linux-androideabi]
rustflags = [
"-Clink-arg=-z",
"-Clink-arg=max-page-size=16384",
"-Clink-arg=-z",
"-Clink-arg=common-page-size=4096",
]

[target.i686-linux-android]
rustflags = [
"-Clink-arg=-z",
"-Clink-arg=max-page-size=16384",
"-Clink-arg=-z",
"-Clink-arg=common-page-size=4096",
]

[target.x86_64-linux-android]
rustflags = [
"-Clink-arg=-z",
"-Clink-arg=max-page-size=16384",
"-Clink-arg=-z",
"-Clink-arg=common-page-size=4096",
]
7 changes: 7 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# max-page-size=16384:
# Android 15 (API 35) introduces support for 16KB page sizes to improve performance on devices with larger RAM.
# Apps with native libraries MUST be compiled with 16KB ELF alignment or they will crash on startup
# on devices configured with 16KB page sizes. This flag ensures proper alignment for both 32-bit and 64-bit targets.
# Reference: https://developer.android.com/guide/practices/page-sizes
RUSTFLAGS = "-C link-arg=-Wl,-z,max-page-size=16384"

[build]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
Expand Down