dart-lang / native

Dart packages related to FFI and native assets bundling.
BSD 3-Clause "New" or "Revised" License
117 stars 40 forks source link

[native_toolchain_c] Android 15 16kb elf alignment #1611

Open dcharkes opened 2 days ago

dcharkes commented 2 days ago

Android 15 has the support to require dylib elf sections to be 16kb aligned.

We should probably have a default flag for this in package:native_toolchain_c so that packages using flutter create --template package_ffi will work out of the box for Android 15 devices with 16kb memory pages.

Context:

reidbaker commented 2 days ago

Also possibly related https://github.com/flutter/flutter/issues/125090

mkustermann commented 2 days ago

Out of curiosity: Does Android's NDK compiler toolchain not automatically use 16 KB by-default? Or is this for handling older Android compiler toolchains that don't have that default yet?

HosseinYousefi commented 2 days ago

Related: https://github.com/dart-lang/native/issues/1608

Out of curiosity: Does Android's NDK compiler toolchain not automatically use 16 KB by-default? Or is this for handling older Android compiler toolchains that don't have that default yet?

NDK r27 does with this flag set: -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON

dcharkes commented 2 days ago

Out of curiosity: Does Android's NDK compiler toolchain not automatically use 16 KB by-default? Or is this for handling older Android compiler toolchains that don't have that default yet?

We're currently still on r26b on the CI here:

https://github.com/dart-lang/native/blob/16918aef9da60646e5ae0ad0307fe0e1a64355b2/.github/workflows/native.yaml#L55

Also flutter_tools is at 26 at the moment:

https://github.com/flutter/flutter/blob/9be22b58c4bfe8b6cb447de13a500db4e1bd8c33/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy#L58-L63

If you invoke 27 or up directly (not via Groovy, Kotlin, or Application.mk) it also requires passing the flag: https://developer.android.com/guide/practices/page-sizes#other-build-systems

dcharkes commented 2 days ago

Bumping the version on the CI here: