Skip to content

Commit 09a4d35

Browse files
authored
[clr-ios] Enable Release builds and dynamic linking on Apple mobile (#121117)
## Description This PR enables the interpreter by default on Apple mobile platforms and enables dynamic linking in AppleAppBuilder used in the testing pipeline. Contributes to #119006 Fixes #121023
1 parent fe17c2c commit 09a4d35

File tree

13 files changed

+84
-70
lines changed

13 files changed

+84
-70
lines changed

eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ jobs:
174174
parameters:
175175
jobTemplate: /eng/pipelines/common/global-build-job.yml
176176
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
177-
buildConfig: Checked
177+
buildConfig: Release
178178
runtimeFlavor: coreclr
179179
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
180180
isiOSLikeOnlyBuild: ${{ parameters.isiOSLikeOnlyBuild }}

eng/pipelines/performance/templates/perf-ios-scenarios-build-jobs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- template: /eng/pipelines/common/platform-matrix.yml
2626
parameters:
2727
jobTemplate: /eng/pipelines/common/global-build-job.yml
28-
buildConfig: checked
28+
buildConfig: release
2929
runtimeFlavor: coreclr
3030
platforms:
3131
- ios_arm64

eng/pipelines/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ extends:
10601060
parameters:
10611061
jobTemplate: /eng/pipelines/common/global-build-job.yml
10621062
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
1063-
buildConfig: Checked
1063+
buildConfig: Release
10641064
runtimeFlavor: coreclr
10651065
platforms:
10661066
- ios_arm64

src/coreclr/clr.featuredefines.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
<FeatureObjCMarshal>true</FeatureObjCMarshal>
3737
</PropertyGroup>
3838

39+
<PropertyGroup Condition="'$(TargetsMacCatalyst)' == 'true' OR '$(TargetsiOS)' == 'true' OR '$(TargetstvOS)' == 'true'">
40+
<FeatureInterpreter>true</FeatureInterpreter>
41+
</PropertyGroup>
42+
3943
<PropertyGroup Condition="('$(Platform)' == 'x64' OR '$(Platform)' == 'arm64') AND ('$(Configuration)' == 'debug' OR '$(Configuration)' == 'checked') AND '$(TargetsAndroid)' != 'true'">
4044
<FeatureInterpreter>true</FeatureInterpreter>
4145
</PropertyGroup>

src/coreclr/clrfeatures.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ if(NOT DEFINED FEATURE_INTERPRETER)
4343
set(FEATURE_INTERPRETER 1)
4444
set(FEATURE_PORTABLE_ENTRYPOINTS 1)
4545
set(FEATURE_PORTABLE_HELPERS 1)
46+
elseif(CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_TARGET_MACCATALYST)
47+
set(FEATURE_INTERPRETER 1)
4648
else()
4749
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
4850
set(FEATURE_INTERPRETER $<IF:$<CONFIG:Debug,Checked>,1,0>)

src/coreclr/interpreter/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,8 @@ target_link_libraries(clrinterpreter
6767
${INTERPRETER_LINK_LIBRARIES}
6868
)
6969

70-
install_clr(TARGETS clrinterpreter DESTINATIONS . sharedFramework COMPONENT runtime OPTIONAL)
70+
if (CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_TARGET_MACCATALYST)
71+
install_clr(TARGETS clrinterpreter DESTINATIONS . COMPONENT runtime OPTIONAL)
72+
else()
73+
install_clr(TARGETS clrinterpreter DESTINATIONS . sharedFramework COMPONENT runtime OPTIONAL)
74+
endif()

src/coreclr/vm/arm64/asmconstants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,11 @@ ASMCONSTANTS_C_ASSERT(OFFSETOF__ThreadLocalInfo__m_pThread == offsetof(ThreadLoc
305305
ASMCONSTANTS_C_ASSERT(OFFSETOF__InterpMethod__pCallStub == offsetof(InterpMethod, pCallStub))
306306

307307
#ifdef TARGET_UNIX
308+
#ifdef _DEBUG
308309
#define OFFSETOF__Thread__m_pInterpThreadContext 0xb30
310+
#else // _DEBUG
311+
#define OFFSETOF__Thread__m_pInterpThreadContext 0x2c8
312+
#endif // _DEBUG
309313
#else // TARGET_UNIX
310314
#define OFFSETOF__Thread__m_pInterpThreadContext 0xb58
311315
#endif // TARGET_UNIX

src/mono/sample/iOS/Program.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@ private static void OnButtonClick()
3737
{
3838
SetText("OnButtonClick! #" + counter++);
3939
}
40-
#if CORECLR_TEST
41-
public static int Main(string[] args)
42-
{
43-
Console.WriteLine("Done!");
44-
Thread.Sleep(Timeout.Infinite);
45-
return 42;
46-
}
47-
#else
4840
#if CI_TEST
4941
public static async Task<int> Main(string[] args)
5042
#else
@@ -72,5 +64,4 @@ public static async Task Main(string[] args)
7264
await Task.Delay(-1);
7365
#endif
7466
}
75-
#endif
7667
}

src/mono/sample/iOS/Program.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<TargetOS Condition="'$(TargetOS)' == ''">iossimulator</TargetOS>
77
<RuntimeIdentifier>$(TargetOS)-$(TargetArchitecture)</RuntimeIdentifier>
88
<DefineConstants Condition="'$(ArchiveTests)' == 'true'">$(DefineConstants);CI_TEST</DefineConstants>
9-
<DefineConstants Condition="'$(UseMonoRuntime)' != 'true'">$(DefineConstants);CORECLR_TEST</DefineConstants>
109
<AppName>HelloiOS</AppName>
1110
<MainLibraryFileName>$(AssemblyName).dll</MainLibraryFileName>
1211
<SelfContained>true</SelfContained>
@@ -29,9 +28,9 @@
2928

3029
<ItemGroup>
3130
<RuntimeComponents Condition="'$(DiagnosticPorts)' != ''" Include="diagnostics_tracing" />
31+
<EnvironmentVariables Condition="'$(UseMonoRuntime)' != 'true'" Include="DOTNET_Interpreter=%2A%21%2A" />
3232
<EnvironmentVariables Condition="'$(UseMonoRuntime)' != 'true'" Include="DOTNET_InterpMode=3" />
3333
<EnvironmentVariables Condition="'$(UseMonoRuntime)' != 'true'" Include="DOTNET_ReadyToRun=0" />
34-
<EnvironmentVariables Condition="'$(UseMonoRuntime)' != 'true'" Include="DOTNET_InterpDump=*!*" />
3534
</ItemGroup>
3635

3736
<Import Project="$(MonoProjectRoot)\msbuild\apple\build\AppleBuild.props" />

src/tasks/AppleAppBuilder/AppleAppBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public override bool Execute()
342342
{
343343
extraLinkerArgs.Add("-rpath @executable_path");
344344
}
345-
shouldStaticLink = true;
345+
shouldStaticLink = false;
346346
}
347347

348348
var generator = new Xcode(Log, TargetOS, Arch);

0 commit comments

Comments
 (0)