Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions build-tools/create-packs/Microsoft.Android.Runtime.proj
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ projects that use the Microsoft.Android.Runtimes framework in .NET 6+.
Condition=" '%(_AndroidNdkRedistributable.AndroidRID)' == '$(AndroidRID)' And '%(_AndroidNdkRedistributable.Kind)' == 'Toolchain' " />
</ItemGroup>

<!-- NativeAOT applications do not link libc++, so its archives are only shipped for CoreCLR. -->
<ItemGroup Condition=" '$(AndroidRuntime)' == 'CoreCLR' ">
<NativeRuntimeAsset Include="@(_AndroidNdkRedistributable)"
Condition=" '%(_AndroidNdkRedistributable.AndroidRID)' == '$(AndroidRID)' And '%(_AndroidNdkRedistributable.Kind)' == 'CplusPlus' " />
</ItemGroup>

<ItemGroup Condition=" '$(AndroidRuntime)' == 'NativeAOT' ">
<NativeRuntimeAsset Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnaot-android.debug-static-debug.a') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnaot-android.debug-static-debug.a" />
<NativeRuntimeAsset Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnaot-android.release-static-release.a') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnaot-android.release-static-release.a" />
Expand Down
4 changes: 0 additions & 4 deletions build-tools/scripts/Ndk.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<AndroidRID>android-arm</AndroidRID>
<ToolchainPrefix>arm-linux-androideabi</ToolchainPrefix>
<ClangArch>arm</ClangArch>
<UnwindArchDir>arm</UnwindArchDir>
<SupportMonoVM>True</SupportMonoVM>
<SupportCoreCLR>True</SupportCoreCLR>
<SupportNativeAOT>True</SupportNativeAOT>
Expand All @@ -37,7 +36,6 @@
<AndroidRID>android-arm64</AndroidRID>
<ToolchainPrefix>aarch64-linux-android</ToolchainPrefix>
<ClangArch>aarch64</ClangArch>
<UnwindArchDir>aarch64</UnwindArchDir>
<SupportMonoVM>True</SupportMonoVM>
<SupportCoreCLR>True</SupportCoreCLR>
<SupportNativeAOT>True</SupportNativeAOT>
Expand All @@ -50,7 +48,6 @@
<AndroidRID>android-x86</AndroidRID>
<ToolchainPrefix>i686-linux-android</ToolchainPrefix>
<ClangArch>i686</ClangArch>
<UnwindArchDir>i386</UnwindArchDir>
<SupportMonoVM>True</SupportMonoVM>
<SupportCoreCLR>False</SupportCoreCLR>
<SupportNativeAOT>False</SupportNativeAOT>
Expand All @@ -63,7 +60,6 @@
<AndroidRID>android-x64</AndroidRID>
<ToolchainPrefix>x86_64-linux-android</ToolchainPrefix>
<ClangArch>x86_64</ClangArch>
<UnwindArchDir>x86_64</UnwindArchDir>
<SupportMonoVM>True</SupportMonoVM>
<SupportCoreCLR>True</SupportCoreCLR>
<SupportNativeAOT>True</SupportNativeAOT>
Expand Down
3 changes: 0 additions & 3 deletions build-tools/scripts/Ndk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
<_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\%(ApiLevel)\libz.so')" Kind="System" />
<_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\%(ApiLevel)\crtbegin_so.o')" Kind="Toolchain" />
<_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\%(ApiLevel)\crtend_so.o')" Kind="Toolchain" />
<_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\libc++_static.a')" Kind="CplusPlus" />
<_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\libc++abi.a')" Kind="CplusPlus" />
<_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkClangLibLinux)\libclang_rt.builtins-%(ClangArch)-android.a')" Kind="Toolchain" />
<_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkClangLibLinux)\%(UnwindArchDir)\libunwind.a')" Kind="CplusPlus" />
</ItemGroup>
</Target>
</Project>
4 changes: 2 additions & 2 deletions src/Xamarin.Android.Build.Tasks/Tasks/LinkNativeRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ List<ITaskItem> OrganizeCommandLineItemsCLR (string abi)
// ...and after them the BCL PAL libraries...
ret.AddRange (sets[NativeRuntimeComponents.KnownSets.BCL]);

// ...and then the C/C++ runtime libraries
// ...and then the C runtime and compiler support libraries
var systemLibs = new Dictionary<string, ITaskItem> (StringComparer.Ordinal);
foreach (ITaskItem item in GetAbiItems (LinkLibraries, "_RequiredLinkLibraries", abi)) {
systemLibs.Add (Path.GetFileName (item.ItemSpec), item);
}

ret.Add (systemLibs["log"]);
ret.AddRange (sets[NativeRuntimeComponents.KnownSets.CplusPlusRuntime]);
ret.AddRange (sets[NativeRuntimeComponents.KnownSets.CompilerRuntime]);
ret.Add (systemLibs["z"]);
ret.Add (systemLibs["m"]);
ret.Add (systemLibs["dl"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class KnownSets
{
public const string BCL = "bcl";
public const string CoreClrRuntime = "coreclr";
public const string CplusPlusRuntime = "c++";
public const string CompilerRuntime = "compiler-rt";
public const string XamarinAndroidRuntime = "xaruntime";
}

Expand Down Expand Up @@ -43,7 +43,7 @@ public Archive (string name, string setName, Func<Archive, bool>? include = null
sealed class ClangBuiltinsArchive : Archive
{
public ClangBuiltinsArchive (string clangAbi)
: base ($"libclang_rt.builtins-{clangAbi}-android.a", KnownSets.CplusPlusRuntime)
: base ($"libclang_rt.builtins-{clangAbi}-android.a", KnownSets.CompilerRuntime)
{}
}

Expand Down Expand Up @@ -72,15 +72,6 @@ public ClrArchive (string name, bool wholeArchive = false)
}
}

sealed class CplusPlusArchive : Archive
{
public CplusPlusArchive (string name)
: base (name, KnownSets.CplusPlusRuntime)
{
DontExportSymbols = true;
}
}

readonly ITaskItem[]? monoComponents;

public readonly List<Archive> KnownArchives;
Expand Down Expand Up @@ -127,17 +118,11 @@ public NativeRuntimeComponents (ITaskItem[]? monoComponents)
new AndroidArchive ("libxa-shared-bits-release.a"),
new AndroidArchive ("libxamarin-startup-release.a"),

// C++ standard library
new CplusPlusArchive ("libc++_static.a"),
new CplusPlusArchive ("libc++abi.a"),

// LLVM clang built-ins archives
new ClangBuiltinsArchive ("aarch64"),
new ClangBuiltinsArchive ("arm"),
new ClangBuiltinsArchive ("i686"),
new ClangBuiltinsArchive ("x86_64"),

new CplusPlusArchive ("libunwind.a"), // techically it's from clang
};

// 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
4 changes: 3 additions & 1 deletion src/native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ else()
add_subdirectory(common/java-interop)

if (IS_MONO_RUNTIME OR IS_CLR_RUNTIME)
add_subdirectory(common/libunwind)
add_subdirectory(common/runtime-base)

add_subdirectory(${SOURCES_PREFIX}/runtime-base)
Expand All @@ -658,6 +657,9 @@ else()
endif()

if (IS_MONO_RUNTIME)
# Only `mono/tracing` links `xa::unwind`; the CoreCLR host has no unwinder of its own.
add_subdirectory(common/libunwind)

add_subdirectory(mono/tracing)
add_subdirectory(mono/pinvoke-override)

Expand Down
24 changes: 17 additions & 7 deletions src/native/CMakePresets.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,17 @@
"hidden": true,
"inherits": "common",
"cacheVariables": {
"ANDROID_STL": "c++_static",
"ANDROID_STL": "none",
"ANDROID_CPP_FEATURES": "no-rtti no-exceptions"
}
},

{
"name": "coreclr-default-common",
"hidden": true,
"inherits": "common",
"cacheVariables": {
"ANDROID_STL": "none",
"ANDROID_CPP_FEATURES": "no-rtti no-exceptions"
}
Comment on lines +70 to +74
},
Expand Down Expand Up @@ -158,7 +168,7 @@

{
"name": "coreclr-default-debug-armeabi-v7a",
"inherits": ["default-common", "common-debug", "common-armeabi-v7a"]
"inherits": ["coreclr-default-common", "common-debug", "common-armeabi-v7a"]
},

{
Expand All @@ -173,7 +183,7 @@

{
"name": "coreclr-default-release-armeabi-v7a",
"inherits": ["default-common", "common-release", "common-armeabi-v7a"]
"inherits": ["coreclr-default-common", "common-release", "common-armeabi-v7a"]
},

{
Expand Down Expand Up @@ -222,7 +232,7 @@

{
"name": "coreclr-default-debug-arm64-v8a",
"inherits": ["default-common", "common-debug", "common-arm64-v8a"]
"inherits": ["coreclr-default-common", "common-debug", "common-arm64-v8a"]
},

{
Expand All @@ -237,7 +247,7 @@

{
"name": "coreclr-default-release-arm64-v8a",
"inherits": ["default-common", "common-release", "common-arm64-v8a"]
"inherits": ["coreclr-default-common", "common-release", "common-arm64-v8a"]
},

{
Expand Down Expand Up @@ -330,7 +340,7 @@

{
"name": "coreclr-default-debug-x86_64",
"inherits": ["default-common", "common-debug", "common-x86_64"]
"inherits": ["coreclr-default-common", "common-debug", "common-x86_64"]
},

{
Expand All @@ -345,7 +355,7 @@

{
"name": "coreclr-default-release-x86_64",
"inherits": ["default-common", "common-release", "common-x86_64"]
"inherits": ["coreclr-default-common", "common-release", "common-x86_64"]
},

{
Expand Down
9 changes: 0 additions & 9 deletions src/native/native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,6 @@
RuntimePackName="$(_RuntimePackName)" />
</ItemGroup>

<!-- NativeAOT applications do not link libc++, so its archives are only shipped for CoreCLR. -->
<ItemGroup Condition=" '$(CMakeRuntimeFlavor)' == 'CoreCLR' ">
<_RuntimePackFiles Include="@(_AndroidNdkRedistributable)"
Condition=" '%(_AndroidNdkRedistributable.Kind)' == 'CplusPlus' "
AndroidRID="%(_AndroidNdkRedistributable.AndroidRID)"
AndroidRuntime="$(CMakeRuntimeFlavor)"
RuntimePackName="$(_RuntimePackName)" />
</ItemGroup>

<Copy
SourceFiles="%(_RuntimePackFiles.Identity)"
DestinationFolder="$(MicrosoftAndroidPacksRootDir)Microsoft.Android.Runtime.%(_RuntimePackFiles.RuntimePackName).$(AndroidApiLevel).%(_RuntimePackFiles.AndroidRID)\$(AndroidPackVersion)\runtimes\%(_RuntimePackFiles.AndroidRID)\native"
Expand Down
Loading