Skip to content

Conversation

@MarijnS95
Copy link
Member

https://developer.android.com/guide/practices/page-sizes

Since Android 15 devices are allowed to run with 16KiB pages which requires all ELF sections to be 16KiB aligned. In addition, when shared objects are placed uncompressed in the .apk Android is able to mmap() them directly out of the .zip file as long as they are also 16KiB-aligned (otherwise they are decompressed to disk first). The latter step unfortunately requires zipalign from build-tools 35.0.0 as the -P flag (to specifically align uncompressed shared objects) did not exist in older releases yet.

There is no step that validates that user-libraries from e.g. package.metadata.android.runtime_libs have 16KiB-aligned pages internally, but the Rust library from the crate that we compile and link via cargo will be configured to link using 16KiB alignment on NDK < r28; it has become the default since r28.

https://developer.android.com/guide/practices/page-sizes

Since Android 15 devices are allowed to run with 16KiB pages which
requires all ELF sections to be 16KiB aligned.  In addition, when
shared objects are placed uncompressed in the `.apk` Android is able
to `mmap()` them directly out of the `.zip` file as long as they are
also 16KiB-aligned (otherwise they are decompressed to disk first). The
latter step unfortunately requires `zipalign` from `build-tools 35.0.0`
as the `-P` flag (to specifically align uncompressed shared objects) did
not exist in older releases yet.

There is no step that validates that user-libraries from e.g.
`package.metadata.android.runtime_libs` have 16KiB-aligned pages
internally, but the Rust library from the crate that we compile and link
via `cargo` will be configured to link using 16KiB alignment on NDK <
r28; it has become the default since r28.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants