-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create managed version of llvm-objcopy
#9692
Comments
Can you post an example of the input and output files? This seems to be simple enough operation that could likely be easily written by reusing the code from NativeAOT ELF ObjWriter. |
The inputs and outputs can be found in any .NET for Android project, ie:
|
Here's a rough implementation of the code to append the It compiles with both .NET 9.0 and .NET 4.8. Not everything is written as efficiently as it could be. I compared the output with the one you provided. It differs in the contents of |
Notably, you could also shave off some time if you create the |
It looks like these come from:
Here is the |
The build-id of |
A quick and dirty test of this code seems very promising: Debug - EmbedAssembliesInApk - android
Tested by:
|
Out of curiosity, what causes the overhead? Is it just the subprocess spawning, or does Thanks for taking the issue seriously by the way – this performance regression blocks our net9 upgrade. |
That is my hunch, yes. Spawning a process (on Windows at least) takes a non-trivial amount of time, and the default .NET for Android template references ~170 assemblies. Shelling out to |
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 tollvm-objcopy
:There is considerable overhead to this process.
In this example we spend ~42 seconds in this step:
A managed version that did not need to shell out to external processes of this would likely be faster.
Some potential options:
llvm-objcopy
to managed code using managed LLVM bindings (potentiallyLLVMSharp
)The text was updated successfully, but these errors were encountered: