Open
Description
Context: #9455
For each assembly/pdb/config/others file we wrap as a .so
in order to place in the /lib
directory of an APK, we shell out twice to llvm-objcopy
:
llvm-objcopy.EXE --add-section payload=obj\Debug\net9.0-android\android\assets\arm64-v8a\myproject.dll obj\Debug\net9.0-android\android-arm64\wrapped\lib_myproject.dll.so
llvm-objcopy.EXE --set-section-flags payload=readonly,data --set-section-alignment payload=16384 obj\Debug\net9.0-android\android-arm64\wrapped\lib_myproject.dll.so
There is considerable overhead to this process.
In this example we spend ~42 seconds in this step:
dotnet new android
dotnet build -p:EmbedAssembliesIntoApk=true
A managed version that did not need to shell out to external processes of this would likely be faster.
Some potential options:
- https://github.com/xoofx/LibObjectFile (.NET 8+ 😢)
- Porting
llvm-objcopy
to managed code using managed LLVM bindings (potentiallyLLVMSharp
)