ITADN

Use 16 KB ELF alignment for shared native libraries

#7897Pull Requestmannodermaus 创建于 2024-07-30
cla: yes
M
mannodermauscommented
Starting from the upcoming Android 15, the possibility for devices configured with a memory page size of 16 KB (rather than the default 4 KB) becomes available to OEMs. This has an impact on how native code must be packed into Android applications in order to prevent crashes at runtime when unaligned code is being loaded on these devices (ref https://github.com/realm/realm-java/issues/7894). This PR applies [the suggested migration steps](https://developer.android.com/guide/practices/page-sizes) for 16 KB ELF packaging to the output of `realm-library`. As I did not want to upgrade the entire stack to AGP 8.3+ and NDK 27+, it follows the "legacy path" that yields the same results: After building the native libraries with these flags, calls to `Realm.init()` no longer cause an immediate crash on devices/emulators configured with 16 KB page size. Full disclaimer: This change also applies to the `objectServer` binaries, which we aren't using for our use case. I don't know if there are any ramifications of 16 KB page size for those binaries.
合并状态:未合并 关闭于 2024-09-13 7 条评论