diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets
index 14eb57c1134..8de77b2c654 100644
--- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets
+++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets
@@ -25,6 +25,12 @@ This file contains the NativeAOT-specific MSBuild logic for .NET for Android.
<_GenerateProguardAfterTargets>_AndroidComputeIlcCompileInputs
+
+ static
+
+ true
@@ -107,10 +113,19 @@ This file contains the NativeAOT-specific MSBuild logic for .NET for Android.
$(_NdkAbi)-linux-android$(_NDKApiLevel)-clang$(_NdkWrapperScriptExt)
$(_NdkAbi)-linux-android$(_NDKApiLevel)-clang$(_NdkWrapperScriptExt)
llvm-objcopy
+
+ llvm-ar
false
+
+
+
true
-
+
@@ -258,6 +273,61 @@ This file contains the NativeAOT-specific MSBuild logic for .NET for Android.
DependsOnTargets="_GenerateNativeAotAndroidAppAssemblerSources">
+
+
+
+ <_AndroidNativeAotSharedLibrary>$(NativeOutputPath)$(NativeBinaryPrefix)$(TargetName).so
+
+
+ <_AndroidNativeAotLinkerArgs Include=""$(NativeObject)"" />
+ <_AndroidNativeAotLinkerArgs Include="-shared" />
+ <_AndroidNativeAotLinkerArgs Include="-fuse-ld=lld" />
+ <_AndroidNativeAotLinkerArgs Include="-o "$(_AndroidNativeAotSharedLibrary)"" />
+
+ <_AndroidNativeAotLinkerArgs Include="-Wl,-e,0x0" />
+ <_AndroidNativeAotLinkerArgs Include="-Wl,-z,max-page-size=16384" />
+ <_AndroidNativeAotLinkerArgs Include="-Wl,--version-script="$(ExportsFile)"" Condition="'$(ExportsFile)' != ''" />
+ <_AndroidNativeAotLinkerArgs Include="-Wl,--export-dynamic" Condition="'$(ExportsFile)' != ''" />
+ <_AndroidNativeAotLinkerArgs Include="-Wl,--discard-all" />
+ <_AndroidNativeAotLinkerArgs Include="-Wl,--gc-sections" />
+ <_AndroidNativeAotLinkerArgs Include="-Wl,-T,"$(NativeIntermediateOutputPath)sections.ld"" />
+ <_AndroidNativeAotLinkerArgs Include="@(LinkerArg)" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(NativeBinaryPrefix)$(TargetName).so
+ PreserveNewest
+
+
+
+
+
+
+
-
+