-
Notifications
You must be signed in to change notification settings - Fork 564
Description
Android framework version
net9.0-android
Affected platform version
.NET 9.0.306
Description
Google has a commit in their repos to permit the check_elf_alignment.sh tool to permit alignments of native .so files that are > 16 KB to be properly detected as aligned to 16 KB when it is a power pf 2: https://android.googlesource.com/platform//system/extras/+/3c784e9fd9f4e3f8e363a023939567c41c19d634%5E%21/#F0
When I run the current check_elf_alignment.sh tool on an APK of mine that embeds a native .so that has 64 KB alignment, the tool correctly detects that the .so complies:
check_elf_alignment.sh bin/Release/net9.0-android/com.company.test-Signed.apk|grep libfoo
/var/folders/8g/ryl04lk527q60vyh3qv3gdqm0000gn/T/com.company.test-Signed_out_XXXXX.rsIhxEUdWy/lib/arm64-v8a/libfoo.so: \e[32mALIGNED\e[0m (2**16)
However, I get an incorrect warning from dotnet android in my dotnet publish of the APK:
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.105/tools/Xamarin.Android.Common.targets(2092,3): warning XA0141: Android 16 will require 16 KB page sizes, shared library 'libfoo.so' does not have a 16 KB page size. Please inform the authors of the NuGet package 'com.company.test' version '1.6.3' which contains 'runtimes/android-arm64/native/libfoo.so'. See https://developer.android.com/guide/practices/page-sizes for more details.
Checking the code in this repo at
| // TODO: what happens if the library is aligned at, say, 64k while 16k is required? Should we erorr out? |
It appears that this code was started before Google updated their tool to accept larger page alignments, or maybe was in development while Google was updating their side.
The warning is not terrible for my team for internal builds, but since we publish a SDK to customers, they will see it in their builds. We can release note it, but it's still not ideal.
I think the tools could be updated to fix the warning to permit these alignments, given the upstream change from Google.
Steps to Reproduce
Add a native .so to an Android app with > 2^14 page alignment
Did you find any workaround?
No response
Relevant log output
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.105/tools/Xamarin.Android.Common.targets(2092,3): warning XA0141: Android 16 will require 16 KB page sizes, shared library 'libfoo.so' does not have a 16 KB page size. Please inform the authors of the NuGet package 'com.company.test' version '1.6.3' which contains 'runtimes/android-arm64/native/libfoo.so'. See https://developer.android.com/guide/practices/page-sizes for more details.