Skip to content

Commit 3ea02c1

Browse files
authored
[net11.0] Enable CoreCLR for all platforms. (#23977)
Currently only the CoreCLR interpreter works, but that's enough to verify that CoreCLR works, and also run the introspection + monotouch-test tests on CoreCLR.
2 parents 51e1f75 + 27c8f77 commit 3ea02c1

File tree

6 files changed

+38
-2
lines changed

6 files changed

+38
-2
lines changed

Make.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ DOTNET_PLATFORMS=
433433

434434
ifdef INCLUDE_IOS
435435
DOTNET_PLATFORMS+=iOS
436+
DOTNET_CORECLR_PLATFORMS+=iOS
436437
DOTNET_MONOVM_PLATFORMS+=iOS
437438
DOTNET_NATIVEAOT_PLATFORMS+=iOS
438439
DOTNET_IOS_RUNTIME_IDENTIFIERS_NO_ARCH=ios
@@ -458,6 +459,7 @@ endif # INCLUDE_IOS
458459

459460
ifdef INCLUDE_TVOS
460461
DOTNET_PLATFORMS+=tvOS
462+
DOTNET_CORECLR_PLATFORMS+=tvOS
461463
DOTNET_MONOVM_PLATFORMS+=tvOS
462464
DOTNET_NATIVEAOT_PLATFORMS+=tvOS
463465
DOTNET_TVOS_RUNTIME_IDENTIFIERS_NO_ARCH=tvos
@@ -483,6 +485,7 @@ endif
483485

484486
ifdef INCLUDE_MACCATALYST
485487
DOTNET_PLATFORMS+=MacCatalyst
488+
DOTNET_CORECLR_PLATFORMS+=MacCatalyst
486489
DOTNET_MONOVM_PLATFORMS+=MacCatalyst
487490
DOTNET_NATIVEAOT_PLATFORMS+=MacCatalyst
488491
DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS_NO_ARCH=maccatalyst

dotnet/targets/Microsoft.Sdk.Versions.template.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,8 @@
4343
RuntimePackRuntimeIdentifiers="@RUNTIME_PACK_RUNTIME_IDENTIFIERS@"
4444
Profile="@PLATFORM@"
4545
/>
46+
47+
<!-- Need this until https://github.com/dotnet/sdk/pull/51428 is completed -->
48+
<KnownFrameworkReference Update="Microsoft.NETCore.App" RuntimePackRuntimeIdentifiers="%(RuntimePackRuntimeIdentifiers);ios-arm64;iossimulator-x64;iossimulator-arm64;tvos-arm64;tvossimulator-x64;tvossimulator-arm64;maccatalyst-arm64;maccatalyst-x64" />
4649
</ItemGroup>
4750
</Project>

dotnet/targets/Xamarin.Shared.Sdk.targets

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,11 @@
11991199
<_IsDedupEnabled Condition="'$(_IsDedupEnabled)' == '' And '$(_RunAotCompiler)' == 'true' And '$(IsMacEnabled)' == 'true' And '$(TargetArchitectures)' == 'ARM64' And '$(MtouchInterpreter)' != 'all'">true</_IsDedupEnabled>
12001200
<_DedupAssembly Condition="'$(_IsDedupEnabled)' == 'true'">$(IntermediateOutputPath)aot-instances.dll</_DedupAssembly>
12011201

1202+
<!-- This property isn't accurate with CoreCLR, it should probably be renamed to something like '_LibRuntimeLinkMode' at some point -->
1203+
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And '$(UseMonoRuntime)' == 'false'">dylib</_LibMonoLinkMode>
12021204
<!-- default to 'static' for Mac Catalyst to work around https://github.com/dotnet/macios/issues/14686 -->
12031205
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And '$(_PlatformName)' == 'MacCatalyst'">static</_LibMonoLinkMode>
1204-
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And ('$(ComputedPlatform)' != 'iPhone' Or '$(_PlatformName)' == 'macOS')">dylib</_LibMonoLinkMode>
1206+
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And '$(ComputedPlatform)' != 'iPhone'">dylib</_LibMonoLinkMode>
12051207
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == ''">static</_LibMonoLinkMode>
12061208
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'dylib'">dylib</_LibMonoExtension>
12071209
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'static'">a</_LibMonoExtension>
@@ -1245,6 +1247,13 @@
12451247
"
12461248
/>
12471249
</ItemGroup>
1250+
1251+
<!-- CoreCLR: these are variables currently needed to make CoreCLR work -->
1252+
<ItemGroup Condition="'$(UseMonoRuntime)' == 'false' And '$(_PlatformName)' != 'macOS'">
1253+
<!-- Only the interpreter works so far, so make sure only the interpreter executes and that everything is executed with the interpreter -->
1254+
<_BundlerEnvironmentVariables Include="DOTNET_Interpreter" Value="%2A%21%2A" /> <!-- This is the string "*!*" url encoded -->
1255+
<_BundlerEnvironmentVariables Include="DOTNET_ReadyToRun" Value="0" />
1256+
</ItemGroup>
12481257
</Target>
12491258

12501259
<!-- App bundle creation tasks -->

tests/introspection/ApiPInvokeTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ protected void Check (Assembly a)
255255
case "System.Net.Security.Native":
256256
path = null;
257257
break;
258+
case "QCall":
259+
// These symbols are inside libcoreclr.dylib, but they're private, so dlsym won't see them.
260+
continue;
258261
}
259262

260263
var lib = Dlfcn.dlopen (path, 0);

tests/monotouch-test/mono/Symbols.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@ public void FunctionNames ()
1616
bool nativeaot = symbols [1].Contains ("MonoTouchFixtures_Symbols__Collect");
1717
bool llvmonly = symbols [1].Contains ("mono_llvmonly_runtime_invoke"); // LLVM inlines the Collect function, so 'Collect' doesn't show up in the stack trace :/
1818
bool interp = false;
19+
bool coreclr = false;
1920

2021
if (!aot) {
2122
for (int i = 0; i < 5 && !interp; i++) {
2223
/* ves_pinvoke_method (slow path) and do_icall (fast path) are
2324
* MONO_NEVER_INLINE, so they should show up in the backtrace
2425
* reliably */
2526
interp |= symbols [i].Contains ("ves_pinvoke_method") || symbols [i].Contains ("do_icall");
27+
28+
coreclr |= symbols [i].Contains ("ExecuteInterpretedMethod");
2629
}
2730
}
2831

29-
Assert.IsTrue (aot || interp || llvmonly || nativeaot, $"#1\n\t{string.Join ("\n\t", symbols)}");
32+
Assert.IsTrue (aot || interp || llvmonly || nativeaot || coreclr, $"#1\n\t{string.Join ("\n\t", symbols)}");
3033
}
3134

3235
void Collect ()

tests/xharness/Jenkins/TestVariationsFactory.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ IEnumerable<TestData> GetTestData (RunTestTask test)
3636
var x64_runtime_identifier = string.Empty;
3737
var arm64_sim_runtime_identifier = string.Empty;
3838
var x64_sim_runtime_identifier = string.Empty;
39+
var supports_mono = test.Platform != TestPlatform.Mac;
40+
var supports_coreclr = true;
41+
var coreclr_works = Harness.CanRunArm64 || test.Platform == TestPlatform.Mac; // ignore tests on x64 until https://github.com/dotnet/runtime/issues/121631
42+
var ignore_coreclr = coreclr_works ? ignore : true;
3943

4044
switch (test.Platform) {
4145
case TestPlatform.Mac:
@@ -69,6 +73,17 @@ IEnumerable<TestData> GetTestData (RunTestTask test)
6973
}
7074
}
7175
break;
76+
case "introspection":
77+
if (supports_coreclr && supports_mono) { // we only need specific coreclr test if we *also* support mono (otherwise the default test will be coreclr)
78+
yield return new TestData { Variation = "CoreCLR", TestVariation = "coreclr", Ignored = ignore_coreclr };
79+
}
80+
break;
81+
case "monotouch-test":
82+
if (supports_coreclr && supports_mono) { // we only need specific coreclr test if we *also* support mono (otherwise the default test will be coreclr)
83+
yield return new TestData { Variation = "Debug (CoreCLR)", TestVariation = "debug|coreclr", Ignored = ignore_coreclr };
84+
yield return new TestData { Variation = "Release (CoreCLR)", TestVariation = "release|coreclr", Ignored = ignore_coreclr };
85+
}
86+
break;
7287
}
7388

7489
switch (test.ProjectPlatform) {

0 commit comments

Comments
 (0)