Skip to content

Commit

Permalink
Temporarily include libunwind.a from the NDK toolchain
Browse files Browse the repository at this point in the history
MonoVM requires `libunwind.a` on x86_64.  Until the requirement is
removed, we'll include the archive.

dotnet/runtime#107615
  • Loading branch information
grendello committed Sep 10, 2024
1 parent d689718 commit 927988d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions build-tools/create-packs/Microsoft.Android.Runtime.proj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ projects that use the Microsoft.Android framework in .NET 6+.
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\crtbegin_so.o" />
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\crtend_so.o" />
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libclang_rt.builtins-*-android.a" />

<!-- Remove once https://github.com/dotnet/runtime/pull/107615 is merged and released -->
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libunwind.a" />

<FrameworkListFileClass Include="@(_AndroidRuntimePackAssemblies->'%(Filename)%(Extension)')" Profile="Android" />
<FrameworkListFileClass Include="@(_AndroidRuntimePackAssets->'%(Filename)%(Extension)')" Profile="Android" />
</ItemGroup>
Expand Down
11 changes: 10 additions & 1 deletion build-tools/xaprepare/xaprepare/Steps/Step_Android_SDK_NDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,18 @@ bool CopyRedistributableFiles (Context context)
BuildAndroidPlatforms.NdkMinimumAPI.ToString (CultureInfo.InvariantCulture)
);

string clangArch = Configurables.Defaults.AbiToClangArch[abi];
CopyFile (abi, crtFilesPath, "crtbegin_so.o");
CopyFile (abi, crtFilesPath, "crtend_so.o");
CopyFile (abi, clangLibPath, $"libclang_rt.builtins-{Configurables.Defaults.AbiToClangArch[abi]}-android.a");
CopyFile (abi, clangLibPath, $"libclang_rt.builtins-{clangArch}-android.a");

// Yay, consistency
if (String.Compare (clangArch, "i686", StringComparison.Ordinal) == 0) {
clangArch = "i386";
}

// Remove once https://github.com/dotnet/runtime/pull/107615 is merged and released
CopyFile (abi, Path.Combine (clangLibPath, clangArch), "libunwind.a");
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public NativeRuntimeComponents (ITaskItem[] monoComponents)
new ClangBuiltinsArchive ("arm"),
new ClangBuiltinsArchive ("i686"),
new ClangBuiltinsArchive ("x86_64"),

// Remove once https://github.com/dotnet/runtime/pull/107615 is merged and released
new Archive ("libunwind.a") {
DontExportSymbols = true,
},
};

// Just the base names of libraries to link into the unified runtime. Must have all the dependencies of all the static archives we
Expand Down

0 comments on commit 927988d

Please sign in to comment.