From af34218ec61c790e247d5281f90eb88657d731f6 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 2 Apr 2026 15:18:40 -0700 Subject: [PATCH 1/9] [R2R] Support multiple R2R modules with per-module frameworks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of linking all R2R .o files into a single large dylib/framework, create a separate framework (or dylib) for each R2R .o file. This way, when only one R2R input changes, only that module's framework needs to be relinked — significantly improving incremental build times. Each R2R .o file exports an RTR_HEADER symbol. To avoid collisions when multiple modules are loaded, each module's dylib uses the linker flags -Wl,-alias,_RTR_HEADER,_RTR_HEADER_ and -Wl,-unexported_symbol,_RTR_HEADER to export a uniquely-named alias. A new MSBuild task (GenerateR2RModuleRegistration) generates a native registration file (r2r_modules.mm) that maps module names to their header pointers. The file is compiled into the main executable and uses __attribute__((constructor)) to register the modules before main(). The runtime's xamarin_get_native_code_data callback now iterates the module table to find the correct R2R header for each owner_composite_name, with a fallback to the single xamarin_rtr_header for backward compat. Changes: - runtime/xamarin/main.h: Add struct xamarin_r2r_module and externs - runtime/runtime.m: Multi-module lookup in get_native_code_data - tools/common/Target.cs: Remove single RTR_HEADER from generated main.mm - msbuild/.../GenerateR2RModuleRegistration.cs: New task - dotnet/targets/Microsoft.Sdk.R2R.targets: Per-module framework/dylib creation with symbol renaming - dotnet/targets/Xamarin.Shared.Sdk.targets: Handle multiple R2R frameworks in post-processing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/targets/Microsoft.Sdk.R2R.targets | 329 ++++++++---------- dotnet/targets/Xamarin.Shared.Sdk.targets | 8 +- .../Tasks/GenerateR2RModuleRegistration.cs | 61 ++++ runtime/runtime.m | 22 +- runtime/xamarin/main.h | 8 + tools/common/Target.cs | 7 - 6 files changed, 243 insertions(+), 192 deletions(-) create mode 100644 msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs diff --git a/dotnet/targets/Microsoft.Sdk.R2R.targets b/dotnet/targets/Microsoft.Sdk.R2R.targets index 71c6f4aff0a7..0492f48a751f 100644 --- a/dotnet/targets/Microsoft.Sdk.R2R.targets +++ b/dotnet/targets/Microsoft.Sdk.R2R.targets @@ -1,6 +1,7 @@ + @@ -134,24 +135,26 @@ - + <_CreateR2RFrameworkDependsOn> _CollectR2RObjectFilesForLinking; - _PrepareR2RFrameworkCreation; - _CreateR2RFrameworkStructure; - _ForceLinkR2RFramework; - _LinkR2RFramework; + _PrepareR2RModules; + _CreateR2RModuleFrameworks; + _GenerateR2RModuleRegistration; - - + <_DesktopFramework Condition="'$(_PlatformName)' == 'macOS' Or '$(_PlatformName)' == 'MacCatalyst'">true @@ -160,81 +163,70 @@ <_R2RFrameworkBinaryInfix Condition="'$(_DesktopFramework)' == 'true'">/Versions/A <_R2RFrameworkResourcesInfix Condition="'$(_DesktopFramework)' == 'true'">/Versions/A/Resources - <_R2RFrameworkIntermediateOutputPath Condition="'$(_R2RFrameworkIntermediateOutputPath)' == ''">$(DeviceSpecificIntermediateOutputPath)r2rframework/ - <_R2RFrameworkName Condition="'$(_R2RFrameworkName)' == ''">$(AssemblyName) - <_R2RFrameworkPath Condition="'$(_R2RFrameworkPath)' == ''">$(_R2RFrameworkIntermediateOutputPath)$(_R2RFrameworkName).framework - <_R2RFrameworkOutput Condition="'$(_R2RFrameworkOutput)' == ''">$(_R2RFrameworkPath)$(_R2RFrameworkBinaryInfix)/$(_R2RFrameworkName) - - <_R2RFrameworkStructureStampFile>$(_R2RFrameworkIntermediateOutputPath)$(_R2RFrameworkName)-structure.stamp - - <_R2RFrameworkInfoPlistPath>$(_R2RFrameworkPath)$(_R2RFrameworkResourcesInfix)/Info.plist - - - - <_R2RFrameworkDirectories Include="$(_R2RFrameworkPath)" /> - - <_R2RFrameworkInputs Include="@(_R2RObjectFilesForLinking)" /> - <_R2RFrameworkLinkerFlags Include="-dynamiclib" /> - <_R2RFrameworkLinkerFlags Include="-Wl,-dead_strip" /> - <_R2RFrameworkLinkerFlags Include="-Wl,-install_name,@rpath/$(_R2RFrameworkName).framework/$(_R2RFrameworkName)" /> - - <_FrameworkNativeReference Include="$(_R2RFrameworkPath)/$(_R2RFrameworkName)" Kind="Framework" /> - - - - <_R2RFrameworkDirectories Include="$(_R2RFrameworkPath)/Versions/A/Resources" /> - - <_R2RFrameworkSymlinks Include="$(_R2RFrameworkPath)/Resources" SymlinkTo="Versions/A/Resources" /> - <_R2RFrameworkSymlinks Include="$(_R2RFrameworkPath)/$(_R2RFrameworkName)" SymlinkTo="Versions/A/$(_R2RFrameworkName)" /> - <_R2RFrameworkSymlinks Include="$(_R2RFrameworkPath)/Versions/Current" SymlinkTo="A" /> - - - - - <_R2RFrameworkCachePath>$(_R2RFrameworkIntermediateOutputPath)cache.txt - <_R2RFrameworkCachePath2>$(_R2RFrameworkCachePath).uptodate + <_R2RModuleIntermediateOutputPath Condition="'$(_R2RModuleIntermediateOutputPath)' == ''">$(DeviceSpecificIntermediateOutputPath)r2rframework/ + <_R2RModuleRegistrationFile>$(_R2RModuleIntermediateOutputPath)r2r_modules.mm - - <_R2RFrameworkCache Include="@(_R2RFrameworkInputs)" /> - <_R2RFrameworkCache Include="@(_R2RFrameworkLinkerFlags)" /> - <_R2RFrameworkCache Include="$(_R2RFrameworkOutput)" /> - <_R2RFrameworkCache Include="$(_MinimumOSVersion)" /> - - - - - - - + - + <_R2RModule Include="@(_ReadyToRunObjectFilesToLink)"> + + $([System.Text.RegularExpressions.Regex]::Replace ('%(Filename)', '\.r2r$', '')) + + $([System.Text.RegularExpressions.Regex]::Replace ($([System.Text.RegularExpressions.Regex]::Replace ('%(Filename)', '\.r2r$', '')), '[^a-zA-Z0-9_]', '_')) + + <_R2RModule Update="@(_R2RModule)"> + RTR_HEADER_%(SanitizedName) + %(NativeLinkerInputPath) + %(ModuleName).r2r + $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r.framework + $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r.framework$(_R2RFrameworkBinaryInfix)/%(ModuleName).r2r + $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r.framework$(_R2RFrameworkResourcesInfix)/Info.plist + $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-structure.stamp + $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-cache.txt + $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-cache.txt.uptodate + $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r.dylib + $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-dylib-cache.txt + $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-dylib-cache.txt.uptodate + - + + + + + + - + + + <_CurrentR2RModuleLinkerFlags Remove="@(_CurrentR2RModuleLinkerFlags)" /> + <_CurrentR2RModuleLinkerFlags Include="-dynamiclib" /> + <_CurrentR2RModuleLinkerFlags Include="-Wl,-dead_strip" /> + <_CurrentR2RModuleLinkerFlags Include="-Wl,-alias,_RTR_HEADER,_%(_R2RModule.SymbolName)" /> + <_CurrentR2RModuleLinkerFlags Include="-Wl,-unexported_symbol,_RTR_HEADER" /> + <_CurrentR2RModuleLinkerFlags Include="-Wl,-install_name,@rpath/%(_R2RModule.FrameworkName).framework/%(_R2RModule.FrameworkName)" /> + + + + + + - - - + <_FrameworkNativeReference Include="%(_R2RModule.FrameworkPath)/%(_R2RModule.FrameworkName)" Kind="Framework" /> - - - - - - + + - - + - - - - + - + + + <_CurrentR2RDylibLinkerFlags Remove="@(_CurrentR2RDylibLinkerFlags)" /> + <_CurrentR2RDylibLinkerFlags Include="-dynamiclib" /> + <_CurrentR2RDylibLinkerFlags Include="-Wl,-dead_strip" /> + <_CurrentR2RDylibLinkerFlags Include="-Wl,-alias,_RTR_HEADER,_%(_R2RModule.SymbolName)" /> + <_CurrentR2RDylibLinkerFlags Include="-Wl,-unexported_symbol,_RTR_HEADER" /> + <_CurrentR2RDylibLinkerFlags Include="-Wl,-install_name,@rpath/%(_R2RModule.ModuleName).r2r.dylib" /> + - - - <_CreateR2RDylibDependsOn> - _CollectR2RObjectFilesForLinking; - _PrepareR2RDylibCreation; - _ForceLinkR2RDylib; - _LinkR2RDylib; - - + - - <_R2RDylibIntermediateOutputPath Condition="'$(_R2RFrameworkIntermediateOutputPath)' == ''">$(DeviceSpecificIntermediateOutputPath)r2rdylib/ - <_R2RDylibName Condition="'$(_R2RDylibName)' == ''">$(AssemblyName) - <_R2RDylibPath Condition="'$(_R2RDylibPath)' == ''">$(_R2RDylibIntermediateOutputPath) - <_R2RDylibOutput Condition="'$(_R2RDylibOutput)' == ''">$(_R2RDylibPath)$(_R2RDylibName).r2r.dylib - + MinimumOSVersion="$(_MinimumOSVersion)" + SdkDevPath="$(_SdkDevPath)" + SdkIsSimulator="$(_SdkIsSimulator)" + SdkRoot="$(_SdkRoot)" + TargetArchitectures="$(TargetArchitectures)" + TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)" + /> + - <_R2RDylibInputs Include="@(_R2RObjectFilesForLinking)" /> - <_R2RDylibLinkerFlags Include="-dynamiclib" /> - <_R2RDylibLinkerFlags Include="-Wl,-dead_strip" /> - <_R2RDylibLinkerFlags Include="-Wl,-install_name,@rpath/$(_R2RDylibName).r2r.dylib" /> - - <_FileNativeReference Include="$(_R2RDylibOutput)" Kind="Dynamic" /> + <_FileNativeReference Include="%(_R2RModule.DylibOutput)" Kind="Dynamic" /> - - - <_R2RDylibCachePath>$(_R2RDylibIntermediateOutputPath)cache.txt - <_R2RDylibCachePath2>$(_R2RDylibCachePath).uptodate - - <_R2RDylibCache Include="@(_R2RDylibInputs)" /> - <_R2RDylibCache Include="@(_R2RDylibLinkerFlags)" /> - <_R2RDylibCache Include="$(_R2RDylibOutput)" /> - <_R2RDylibCache Include="$(_MinimumOSVersion)" /> + + - - - + + - + + - + <_MainFile Include="$(_R2RModuleRegistrationFile)" /> - - - - - - + - - + - - + + + <_CreateR2RDylibDependsOn> + _CollectR2RObjectFilesForLinking; + _PrepareR2RModules; + _CreateR2RModuleDylibs; + _GenerateR2RModuleRegistration; + + - + <_PostProcessingItem @@ -2655,11 +2655,11 @@ global using nfloat = global::System.Runtime.InteropServices.NFloat%3B Framework %(Filename).framework.dSYM - + <_PostProcessingItem - Include="$([System.IO.Path]::GetFileName('$(AppBundleDir)'))/$(_AppFrameworksRelativePath)$(_R2RFrameworkName).framework/$(_R2RFrameworkName)" Condition="'$(CreateR2RFramework)' == 'true'"> + Include="@(_R2RModule->'$([System.IO.Path]::GetFileName($(AppBundleDir)))/$(_AppFrameworksRelativePath)%(FrameworkName).framework/%(FrameworkName)')" Condition="'$(CreateR2RFramework)' == 'true'"> Framework - $(_R2RFrameworkName).framework.dSYM + %(FrameworkName).framework.dSYM diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs new file mode 100644 index 000000000000..47e064eb4e74 --- /dev/null +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs @@ -0,0 +1,61 @@ +using System.IO; +using System.Text; + +using Microsoft.Build.Framework; + +#nullable enable + +namespace Xamarin.MacDev.Tasks { + public class GenerateR2RModuleRegistration : XamarinTask { + + #region Inputs + [Required] + public ITaskItem [] R2RModules { get; set; } = []; + + [Required] + public string OutputFile { get; set; } = ""; + #endregion + + public override bool Execute () + { + var sb = new StringBuilder (); + + sb.AppendLine ("#include \"xamarin/xamarin.h\""); + sb.AppendLine (); + + foreach (var module in R2RModules) { + var symbolName = module.GetMetadata ("SymbolName"); + sb.AppendLine ($"extern void* {symbolName};"); + } + + sb.AppendLine (); + sb.AppendLine ("static struct xamarin_r2r_module r2r_module_entries [] = {"); + + foreach (var module in R2RModules) { + var moduleName = module.GetMetadata ("ModuleName"); + var symbolName = module.GetMetadata ("SymbolName"); + sb.AppendLine ($"\t{{ \"{moduleName}\", &{symbolName} }},"); + } + + sb.AppendLine ("};"); + sb.AppendLine (); + + sb.AppendLine ("__attribute__ ((constructor))"); + sb.AppendLine ("static void xamarin_register_r2r_modules ()"); + sb.AppendLine ("{"); + sb.AppendLine ("\txamarin_r2r_modules = r2r_module_entries;"); + sb.AppendLine ("\txamarin_r2r_module_count = sizeof (r2r_module_entries) / sizeof (r2r_module_entries [0]);"); + sb.AppendLine ("}"); + + var content = sb.ToString (); + var outputDir = Path.GetDirectoryName (OutputFile); + if (!string.IsNullOrEmpty (outputDir)) + Directory.CreateDirectory (outputDir); + + if (!File.Exists (OutputFile) || File.ReadAllText (OutputFile) != content) + File.WriteAllText (OutputFile, content); + + return !Log.HasLoggedErrors; + } + } +} diff --git a/runtime/runtime.m b/runtime/runtime.m index 41fbe8ba9264..9f727b71abb4 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -81,6 +81,8 @@ enum XamarinNativeLinkMode xamarin_libmono_native_link_mode = XamarinNativeLinkModeStaticObject; const char **xamarin_runtime_libraries = NULL; void *xamarin_rtr_header = NULL; +struct xamarin_r2r_module *xamarin_r2r_modules = NULL; +int xamarin_r2r_module_count = 0; /* Callbacks */ @@ -2439,9 +2441,25 @@ -(struct NSObjectData*) xamarinGetNSObjectData; if (!context || !data || !context->assembly_path || !context->owner_composite_name) return false; - void* r2r_header = xamarin_rtr_header; + void* r2r_header = NULL; + + // Multi-module: look up by owner_composite_name + if (xamarin_r2r_modules != NULL && xamarin_r2r_module_count > 0) { + for (int i = 0; i < xamarin_r2r_module_count; i++) { + if (strcmp (xamarin_r2r_modules [i].name, context->owner_composite_name) == 0) { + r2r_header = xamarin_r2r_modules [i].header; + break; + } + } + if (r2r_header == NULL) + return false; + } else { + // Single-module fallback for backward compatibility + r2r_header = xamarin_rtr_header; + } + if (r2r_header == NULL) - xamarin_assertion_message ("Failed to find the RTR_HEADER symbol."); + return false; Dl_info info; if (dladdr (r2r_header, &info) == 0) diff --git a/runtime/xamarin/main.h b/runtime/xamarin/main.h index eedfc65f300b..4b78e9ebbf64 100644 --- a/runtime/xamarin/main.h +++ b/runtime/xamarin/main.h @@ -129,6 +129,14 @@ extern enum XamarinNativeLinkMode xamarin_libmono_native_link_mode; extern const char** xamarin_runtime_libraries; extern void *xamarin_rtr_header; +struct xamarin_r2r_module { + const char *name; + void *header; +}; + +extern struct xamarin_r2r_module *xamarin_r2r_modules; +extern int xamarin_r2r_module_count; + typedef void (*xamarin_setup_callback) (); typedef int (*xamarin_extension_main_callback) (int argc, char** argv); diff --git a/tools/common/Target.cs b/tools/common/Target.cs index bb864b39db0b..33f2b17d52da 100644 --- a/tools/common/Target.cs +++ b/tools/common/Target.cs @@ -344,11 +344,6 @@ void GenerateMainImpl (StringWriter sw, Abi abi) sw.WriteLine (); sw.WriteLine (assembly_externs); - if (app.PublishReadyToRun == true) { - sw.WriteLine ("extern void* RTR_HEADER;"); - sw.WriteLine (); - } - sw.WriteLine ("void xamarin_register_modules_impl ()"); sw.WriteLine ("{"); sw.WriteLine (assembly_aot_modules); @@ -440,8 +435,6 @@ void GenerateMainImpl (StringWriter sw, Abi abi) sw.WriteLine ("\txamarin_runtime_configuration_name = {0};", string.IsNullOrEmpty (app.RuntimeConfigurationFile) ? "NULL" : $"\"{app.RuntimeConfigurationFile}\""); if (app.Registrar == RegistrarMode.ManagedStatic) sw.WriteLine ("\txamarin_set_is_managed_static_registrar (true);"); - if (app.PublishReadyToRun == true) - sw.WriteLine ("\txamarin_rtr_header = &RTR_HEADER;"); sw.WriteLine ("}"); sw.WriteLine (); sw.Write ("int main"); From f2445b2d7d1cb76ae9f84c07d96f189451f8e8b9 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 3 Apr 2026 09:48:11 +0200 Subject: [PATCH 2/9] Add FrameworkName metadata for R2R post-processing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/targets/Xamarin.Shared.Sdk.targets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index d012b27c2c43..8cf9030c5600 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -2653,12 +2653,14 @@ global using nfloat = global::System.Runtime.InteropServices.NFloat%3B <_PostProcessingItem Include="@(_CreatedFrameworksFromDylibs->'$([System.IO.Path]::GetFileName($(AppBundleDir)))/$(_AppFrameworksRelativePath)%(Filename).framework/%(Filename)')"> Framework + %(Filename) %(Filename).framework.dSYM <_PostProcessingItem Include="@(_R2RModule->'$([System.IO.Path]::GetFileName($(AppBundleDir)))/$(_AppFrameworksRelativePath)%(FrameworkName).framework/%(FrameworkName)')" Condition="'$(CreateR2RFramework)' == 'true'"> Framework + %(FrameworkName) %(FrameworkName).framework.dSYM From 1e817d06e7508d4f5cb4129ab1b453e33ac3290d Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 3 Apr 2026 11:06:10 +0200 Subject: [PATCH 3/9] Update sizes --- .../expected/iOS-CoreCLR-Interpreter-size.txt | 26 +++++++------- .../expected/iOS-CoreCLR-R2R-size.txt | 34 +++++++++---------- .../expected/iOS-MonoVM-interpreter-size.txt | 12 +++---- .../UnitTests/expected/iOS-MonoVM-size.txt | 8 ++--- .../UnitTests/expected/iOS-NativeAOT-size.txt | 6 ++-- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt index 23f7440c0c02..591ee7e168ab 100644 --- a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt @@ -1,30 +1,30 @@ -AppBundleSize: 9,269,302 bytes (9,052.1 KB = 8.8 MB) +AppBundleSize: 9,269,989 bytes (9,052.7 KB = 8.8 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 10,847 bytes (10.6 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) Frameworks/libcoreclr.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libcoreclr.framework/Info.plist: 840 bytes (0.8 KB = 0.0 MB) +Frameworks/libcoreclr.framework/Info.plist: 833 bytes (0.8 KB = 0.0 MB) Frameworks/libcoreclr.framework/libcoreclr: 5,220,544 bytes (5,098.2 KB = 5.0 MB) Frameworks/libSystem.Globalization.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Globalization.Native.framework/Info.plist: 882 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.Globalization.Native.framework/libSystem.Globalization.Native: 109,232 bytes (106.7 KB = 0.1 MB) +Frameworks/libSystem.Globalization.Native.framework/Info.plist: 875 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Globalization.Native.framework/libSystem.Globalization.Native: 109,248 bytes (106.7 KB = 0.1 MB) Frameworks/libSystem.IO.Compression.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 884 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,280 bytes (1,397.7 KB = 1.4 MB) +Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 877 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,296 bytes (1,397.8 KB = 1.4 MB) Frameworks/libSystem.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/Info.plist: 854 bytes (0.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/libSystem.Native: 162,128 bytes (158.3 KB = 0.2 MB) +Frameworks/libSystem.Native.framework/Info.plist: 847 bytes (0.8 KB = 0.0 MB) +Frameworks/libSystem.Native.framework/libSystem.Native: 162,144 bytes (158.3 KB = 0.2 MB) Frameworks/libSystem.Net.Security.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 880 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,000 bytes (85.9 KB = 0.1 MB) +Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 873 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,016 bytes (86.0 KB = 0.1 MB) Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/Info.plist: 910 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/Info.plist: 903 bytes (0.9 KB = 0.0 MB) Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/libSystem.Security.Cryptography.Native.Apple: 194,256 bytes (189.7 KB = 0.2 MB) -Info.plist: 1,168 bytes (1.1 KB = 0.0 MB) +Info.plist: 1,161 bytes (1.1 KB = 0.0 MB) Microsoft.iOS.dll: 98,816 bytes (96.5 KB = 0.1 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,481 bytes (1.4 KB = 0.0 MB) -SizeTestApp: 195,856 bytes (191.3 KB = 0.2 MB) +SizeTestApp: 196,528 bytes (191.9 KB = 0.2 MB) SizeTestApp.dll: 7,680 bytes (7.5 KB = 0.0 MB) System.Collections.Immutable.dll: 14,848 bytes (14.5 KB = 0.0 MB) System.Diagnostics.StackTrace.dll: 8,192 bytes (8.0 KB = 0.0 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt index 6d493f464769..c4e4e27d9c07 100644 --- a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt @@ -1,33 +1,33 @@ -AppBundleSize: 13,233,325 bytes (12,923.2 KB = 12.6 MB) +AppBundleSize: 13,234,078 bytes (12,923.9 KB = 12.6 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: -_CodeSignature/CodeResources: 11,701 bytes (11.4 KB = 0.0 MB) +_CodeSignature/CodeResources: 11,733 bytes (11.5 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) Frameworks/libcoreclr.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libcoreclr.framework/Info.plist: 840 bytes (0.8 KB = 0.0 MB) +Frameworks/libcoreclr.framework/Info.plist: 833 bytes (0.8 KB = 0.0 MB) Frameworks/libcoreclr.framework/libcoreclr: 5,220,544 bytes (5,098.2 KB = 5.0 MB) Frameworks/libSystem.Globalization.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Globalization.Native.framework/Info.plist: 882 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.Globalization.Native.framework/libSystem.Globalization.Native: 109,232 bytes (106.7 KB = 0.1 MB) +Frameworks/libSystem.Globalization.Native.framework/Info.plist: 875 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Globalization.Native.framework/libSystem.Globalization.Native: 109,248 bytes (106.7 KB = 0.1 MB) Frameworks/libSystem.IO.Compression.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 884 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,280 bytes (1,397.7 KB = 1.4 MB) +Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 877 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,296 bytes (1,397.8 KB = 1.4 MB) Frameworks/libSystem.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/Info.plist: 854 bytes (0.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/libSystem.Native: 162,128 bytes (158.3 KB = 0.2 MB) +Frameworks/libSystem.Native.framework/Info.plist: 847 bytes (0.8 KB = 0.0 MB) +Frameworks/libSystem.Native.framework/libSystem.Native: 162,144 bytes (158.3 KB = 0.2 MB) Frameworks/libSystem.Net.Security.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 880 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,000 bytes (85.9 KB = 0.1 MB) +Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 873 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,016 bytes (86.0 KB = 0.1 MB) Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/Info.plist: 910 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/Info.plist: 903 bytes (0.9 KB = 0.0 MB) Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/libSystem.Security.Cryptography.Native.Apple: 194,256 bytes (189.7 KB = 0.2 MB) -Frameworks/SizeTestApp.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/SizeTestApp.framework/Info.plist: 843 bytes (0.8 KB = 0.0 MB) -Frameworks/SizeTestApp.framework/SizeTestApp: 3,946,656 bytes (3,854.2 KB = 3.8 MB) -Info.plist: 1,168 bytes (1.1 KB = 0.0 MB) +Frameworks/SizeTestApp.r2r.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) +Frameworks/SizeTestApp.r2r.framework/Info.plist: 845 bytes (0.8 KB = 0.0 MB) +Frameworks/SizeTestApp.r2r.framework/SizeTestApp.r2r: 3,946,656 bytes (3,854.2 KB = 3.8 MB) +Info.plist: 1,161 bytes (1.1 KB = 0.0 MB) Microsoft.iOS.dll: 98,816 bytes (96.5 KB = 0.1 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,481 bytes (1.4 KB = 0.0 MB) -SizeTestApp: 195,904 bytes (191.3 KB = 0.2 MB) +SizeTestApp: 196,608 bytes (192.0 KB = 0.2 MB) SizeTestApp.dll: 7,680 bytes (7.5 KB = 0.0 MB) System.Collections.Immutable.dll: 13,824 bytes (13.5 KB = 0.0 MB) System.Diagnostics.StackTrace.dll: 7,680 bytes (7.5 KB = 0.0 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt b/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt index 8924c5b7ac34..d3bfd3dc80ef 100644 --- a/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt @@ -1,14 +1,14 @@ -AppBundleSize: 3,617,184 bytes (3,532.4 KB = 3.4 MB) +AppBundleSize: 3,622,195 bytes (3,537.3 KB = 3.5 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 3,997 bytes (3.9 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) -Info.plist: 1,134 bytes (1.1 KB = 0.0 MB) -Microsoft.iOS.dll: 153,088 bytes (149.5 KB = 0.1 MB) +Info.plist: 1,161 bytes (1.1 KB = 0.0 MB) +Microsoft.iOS.dll: 154,112 bytes (150.5 KB = 0.1 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,405 bytes (1.4 KB = 0.0 MB) -SizeTestApp: 2,391,264 bytes (2,335.2 KB = 2.3 MB) +SizeTestApp: 2,391,632 bytes (2,335.6 KB = 2.3 MB) SizeTestApp.dll: 7,680 bytes (7.5 KB = 0.0 MB) -System.Private.CoreLib.aotdata.arm64: 41,392 bytes (40.4 KB = 0.0 MB) -System.Private.CoreLib.dll: 1,003,520 bytes (980.0 KB = 1.0 MB) +System.Private.CoreLib.aotdata.arm64: 41,400 bytes (40.4 KB = 0.0 MB) +System.Private.CoreLib.dll: 1,007,104 bytes (983.5 KB = 1.0 MB) System.Runtime.dll: 5,120 bytes (5.0 KB = 0.0 MB) System.Runtime.InteropServices.dll: 8,192 bytes (8.0 KB = 0.0 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt b/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt index 56605001c70d..25ac69d41f19 100644 --- a/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt @@ -1,14 +1,14 @@ -AppBundleSize: 9,458,846 bytes (9,237.2 KB = 9.0 MB) +AppBundleSize: 9,459,015 bytes (9,237.3 KB = 9.0 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 5,229 bytes (5.1 KB = 0.0 MB) aot-instances.aotdata.arm64: 818,536 bytes (799.4 KB = 0.8 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) -Info.plist: 1,168 bytes (1.1 KB = 0.0 MB) +Info.plist: 1,161 bytes (1.1 KB = 0.0 MB) Microsoft.iOS.aotdata.arm64: 22,888 bytes (22.4 KB = 0.0 MB) -Microsoft.iOS.dll: 49,152 bytes (48.0 KB = 0.0 MB) +Microsoft.iOS.dll: 48,640 bytes (47.5 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,481 bytes (1.4 KB = 0.0 MB) -SizeTestApp: 7,333,840 bytes (7,162.0 KB = 7.0 MB) +SizeTestApp: 7,334,528 bytes (7,162.6 KB = 7.0 MB) SizeTestApp.aotdata.arm64: 1,456 bytes (1.4 KB = 0.0 MB) SizeTestApp.dll: 7,168 bytes (7.0 KB = 0.0 MB) System.Private.CoreLib.aotdata.arm64: 665,552 bytes (650.0 KB = 0.6 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt index f817b59fd2ee..6be9590f6018 100644 --- a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt @@ -1,8 +1,8 @@ -AppBundleSize: 2,486,550 bytes (2,428.3 KB = 2.4 MB) +AppBundleSize: 2,486,702 bytes (2,428.4 KB = 2.4 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 2,589 bytes (2.5 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) -Info.plist: 1,169 bytes (1.1 KB = 0.0 MB) +Info.plist: 1,161 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,808 bytes (1.8 KB = 0.0 MB) -SizeTestApp: 2,480,592 bytes (2,422.5 KB = 2.4 MB) +SizeTestApp: 2,480,752 bytes (2,422.6 KB = 2.4 MB) From df29933d48027bfac96f6145ada6f6a24a935907 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 6 Apr 2026 09:39:56 +0200 Subject: [PATCH 4/9] [tests] Update expected sizes. --- .../UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt | 6 +++--- tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt | 6 +++--- .../UnitTests/expected/iOS-MonoVM-interpreter-size.txt | 4 ++-- tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt index 591ee7e168ab..b160ef8d51ec 100644 --- a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 9,269,989 bytes (9,052.7 KB = 8.8 MB) +AppBundleSize: 9,279,285 bytes (9,061.8 KB = 8.8 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 10,847 bytes (10.6 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) @@ -13,7 +13,7 @@ Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 877 bytes (0.9 Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,296 bytes (1,397.8 KB = 1.4 MB) Frameworks/libSystem.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) Frameworks/libSystem.Native.framework/Info.plist: 847 bytes (0.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/libSystem.Native: 162,144 bytes (158.3 KB = 0.2 MB) +Frameworks/libSystem.Native.framework/libSystem.Native: 162,224 bytes (158.4 KB = 0.2 MB) Frameworks/libSystem.Net.Security.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 873 bytes (0.9 KB = 0.0 MB) Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,016 bytes (86.0 KB = 0.1 MB) @@ -30,7 +30,7 @@ System.Collections.Immutable.dll: 14,848 bytes (14.5 KB = 0.0 MB) System.Diagnostics.StackTrace.dll: 8,192 bytes (8.0 KB = 0.0 MB) System.IO.Compression.dll: 22,528 bytes (22.0 KB = 0.0 MB) System.IO.MemoryMappedFiles.dll: 22,016 bytes (21.5 KB = 0.0 MB) -System.Private.CoreLib.dll: 1,566,208 bytes (1,529.5 KB = 1.5 MB) +System.Private.CoreLib.dll: 1,575,424 bytes (1,538.5 KB = 1.5 MB) System.Reflection.Metadata.dll: 84,480 bytes (82.5 KB = 0.1 MB) System.Runtime.dll: 5,120 bytes (5.0 KB = 0.0 MB) System.Runtime.InteropServices.dll: 8,192 bytes (8.0 KB = 0.0 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt index a13d67f8cf27..d8e0d2301a6c 100644 --- a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 13,234,078 bytes (12,923.9 KB = 12.6 MB) +AppBundleSize: 13,259,886 bytes (12,949.1 KB = 12.6 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 11,733 bytes (11.5 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) @@ -13,7 +13,7 @@ Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 877 bytes (0.9 Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,296 bytes (1,397.8 KB = 1.4 MB) Frameworks/libSystem.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) Frameworks/libSystem.Native.framework/Info.plist: 847 bytes (0.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/libSystem.Native: 162,144 bytes (158.3 KB = 0.2 MB) +Frameworks/libSystem.Native.framework/libSystem.Native: 162,224 bytes (158.4 KB = 0.2 MB) Frameworks/libSystem.Net.Security.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 873 bytes (0.9 KB = 0.0 MB) Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,016 bytes (86.0 KB = 0.1 MB) @@ -22,7 +22,7 @@ Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/Info.plist: 90 Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/libSystem.Security.Cryptography.Native.Apple: 194,256 bytes (189.7 KB = 0.2 MB) Frameworks/SizeTestApp.r2r.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) Frameworks/SizeTestApp.r2r.framework/Info.plist: 845 bytes (0.8 KB = 0.0 MB) -Frameworks/SizeTestApp.r2r.framework/SizeTestApp.r2r: 3,946,656 bytes (3,854.2 KB = 3.8 MB) +Frameworks/SizeTestApp.r2r.framework/SizeTestApp.r2r: 3,963,168 bytes (3,870.3 KB = 3.8 MB) Info.plist: 1,161 bytes (1.1 KB = 0.0 MB) Microsoft.iOS.dll: 98,816 bytes (96.5 KB = 0.1 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt b/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt index d3bfd3dc80ef..14f3ba93f506 100644 --- a/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 3,622,195 bytes (3,537.3 KB = 3.5 MB) +AppBundleSize: 3,622,219 bytes (3,537.3 KB = 3.5 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 3,997 bytes (3.9 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) @@ -8,7 +8,7 @@ PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,405 bytes (1.4 KB = 0.0 MB) SizeTestApp: 2,391,632 bytes (2,335.6 KB = 2.3 MB) SizeTestApp.dll: 7,680 bytes (7.5 KB = 0.0 MB) -System.Private.CoreLib.aotdata.arm64: 41,400 bytes (40.4 KB = 0.0 MB) +System.Private.CoreLib.aotdata.arm64: 41,424 bytes (40.5 KB = 0.0 MB) System.Private.CoreLib.dll: 1,007,104 bytes (983.5 KB = 1.0 MB) System.Runtime.dll: 5,120 bytes (5.0 KB = 0.0 MB) System.Runtime.InteropServices.dll: 8,192 bytes (8.0 KB = 0.0 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt b/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt index 25ac69d41f19..ab7e736bfc04 100644 --- a/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 9,459,015 bytes (9,237.3 KB = 9.0 MB) +AppBundleSize: 9,458,975 bytes (9,237.3 KB = 9.0 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 5,229 bytes (5.1 KB = 0.0 MB) aot-instances.aotdata.arm64: 818,536 bytes (799.4 KB = 0.8 MB) @@ -11,7 +11,7 @@ runtimeconfig.bin: 1,481 bytes (1.4 KB = 0.0 MB) SizeTestApp: 7,334,528 bytes (7,162.6 KB = 7.0 MB) SizeTestApp.aotdata.arm64: 1,456 bytes (1.4 KB = 0.0 MB) SizeTestApp.dll: 7,168 bytes (7.0 KB = 0.0 MB) -System.Private.CoreLib.aotdata.arm64: 665,552 bytes (650.0 KB = 0.6 MB) +System.Private.CoreLib.aotdata.arm64: 665,512 bytes (649.9 KB = 0.6 MB) System.Private.CoreLib.dll: 537,088 bytes (524.5 KB = 0.5 MB) System.Runtime.aotdata.arm64: 784 bytes (0.8 KB = 0.0 MB) System.Runtime.dll: 5,120 bytes (5.0 KB = 0.0 MB) From 955b20ce9cea97a90c906e8aa1b89f37d995676f Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 3 Apr 2026 12:24:22 -0700 Subject: [PATCH 5/9] Address PR feedback: remove fallback, fix incremental builds, add validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove xamarin_rtr_header entirely (declaration, variable, and fallback path in get_native_code_data). There is no good way to select a single fallback image when multiple modules exist. - Fix MSBuild incremental build: add proper Inputs/Outputs to _CreateR2RModuleFrameworks (ObjectFile→FrameworkOutput) and _CreateR2RModuleDylibs (ObjectFile→DylibOutput) so MSBuild correctly detects when a module's .o changes. - Move _FrameworkNativeReference/_FileNativeReference registration to a new always-run _RegisterR2RNativeReferences target so downstream targets see the items even when linking is skipped (up-to-date). - Add metadata validation in GenerateR2RModuleRegistration: log errors for missing ModuleName/SymbolName metadata, and C-escape module names embedded in string literals. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/targets/Microsoft.Sdk.R2R.targets | 30 +++++++++++-------- .../Tasks/GenerateR2RModuleRegistration.cs | 16 +++++++++- runtime/runtime.m | 17 +++-------- runtime/xamarin/main.h | 1 - 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/dotnet/targets/Microsoft.Sdk.R2R.targets b/dotnet/targets/Microsoft.Sdk.R2R.targets index 0492f48a751f..b792ffd821b5 100644 --- a/dotnet/targets/Microsoft.Sdk.R2R.targets +++ b/dotnet/targets/Microsoft.Sdk.R2R.targets @@ -147,6 +147,7 @@ <_CreateR2RFrameworkDependsOn> _CollectR2RObjectFilesForLinking; _PrepareR2RModules; + _RegisterR2RNativeReferences; _CreateR2RModuleFrameworks; _GenerateR2RModuleRegistration; @@ -195,10 +196,23 @@ + + + + <_FrameworkNativeReference Include="@(_R2RModule->'%(FrameworkPath)/%(FrameworkName)')" Kind="Framework" /> + + + <_FileNativeReference Include="@(_R2RModule->'%(DylibOutput)')" Kind="Dynamic" /> + + + @@ -270,11 +284,6 @@ TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)" /> - - - <_FrameworkNativeReference Include="%(_R2RModule.FrameworkPath)/%(_R2RModule.FrameworkName)" Kind="Framework" /> - - @@ -284,7 +293,8 @@ - - - <_FileNativeReference Include="%(_R2RModule.DylibOutput)" Kind="Dynamic" /> - - @@ -358,6 +363,7 @@ <_CreateR2RDylibDependsOn> _CollectR2RObjectFilesForLinking; _PrepareR2RModules; + _RegisterR2RNativeReferences; _CreateR2RModuleDylibs; _GenerateR2RModuleRegistration; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs index 47e064eb4e74..a593b52d65a6 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs @@ -25,6 +25,10 @@ public override bool Execute () foreach (var module in R2RModules) { var symbolName = module.GetMetadata ("SymbolName"); + if (string.IsNullOrEmpty (symbolName)) { + Log.LogError ("Missing '{0}' metadata on item '{1}'.", "SymbolName", module.ItemSpec); + continue; + } sb.AppendLine ($"extern void* {symbolName};"); } @@ -34,7 +38,14 @@ public override bool Execute () foreach (var module in R2RModules) { var moduleName = module.GetMetadata ("ModuleName"); var symbolName = module.GetMetadata ("SymbolName"); - sb.AppendLine ($"\t{{ \"{moduleName}\", &{symbolName} }},"); + if (string.IsNullOrEmpty (moduleName)) { + Log.LogError ("Missing '{0}' metadata on item '{1}'.", "ModuleName", module.ItemSpec); + continue; + } + if (string.IsNullOrEmpty (symbolName)) + continue; // already reported above + var escapedModuleName = moduleName.Replace ("\\", "\\\\").Replace ("\"", "\\\""); + sb.AppendLine ($"\t{{ \"{escapedModuleName}\", &{symbolName} }},"); } sb.AppendLine ("};"); @@ -47,6 +58,9 @@ public override bool Execute () sb.AppendLine ("\txamarin_r2r_module_count = sizeof (r2r_module_entries) / sizeof (r2r_module_entries [0]);"); sb.AppendLine ("}"); + if (Log.HasLoggedErrors) + return false; + var content = sb.ToString (); var outputDir = Path.GetDirectoryName (OutputFile); if (!string.IsNullOrEmpty (outputDir)) diff --git a/runtime/runtime.m b/runtime/runtime.m index 9f727b71abb4..106650caf60c 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -80,7 +80,6 @@ enum XamarinNativeLinkMode xamarin_libmono_native_link_mode = XamarinNativeLinkModeStaticObject; const char **xamarin_runtime_libraries = NULL; -void *xamarin_rtr_header = NULL; struct xamarin_r2r_module *xamarin_r2r_modules = NULL; int xamarin_r2r_module_count = 0; @@ -2443,19 +2442,11 @@ -(struct NSObjectData*) xamarinGetNSObjectData; void* r2r_header = NULL; - // Multi-module: look up by owner_composite_name - if (xamarin_r2r_modules != NULL && xamarin_r2r_module_count > 0) { - for (int i = 0; i < xamarin_r2r_module_count; i++) { - if (strcmp (xamarin_r2r_modules [i].name, context->owner_composite_name) == 0) { - r2r_header = xamarin_r2r_modules [i].header; - break; - } + for (int i = 0; i < xamarin_r2r_module_count; i++) { + if (strcmp (xamarin_r2r_modules [i].name, context->owner_composite_name) == 0) { + r2r_header = xamarin_r2r_modules [i].header; + break; } - if (r2r_header == NULL) - return false; - } else { - // Single-module fallback for backward compatibility - r2r_header = xamarin_rtr_header; } if (r2r_header == NULL) diff --git a/runtime/xamarin/main.h b/runtime/xamarin/main.h index 4b78e9ebbf64..d986b6324de4 100644 --- a/runtime/xamarin/main.h +++ b/runtime/xamarin/main.h @@ -127,7 +127,6 @@ extern bool xamarin_supports_dynamic_registration; extern const char *xamarin_runtime_configuration_name; extern enum XamarinNativeLinkMode xamarin_libmono_native_link_mode; extern const char** xamarin_runtime_libraries; -extern void *xamarin_rtr_header; struct xamarin_r2r_module { const char *name; From 8cea1fde31ea52834971563b4a4f2f02e14f1350 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 3 Apr 2026 13:11:10 -0700 Subject: [PATCH 6/9] Fix build failure and update expected sizes --- dotnet/targets/Xamarin.Shared.Sdk.targets | 3 +- .../expected/iOS-CoreCLR-R2R-size.txt | 32 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 8cf9030c5600..e27c46a906f0 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -2660,8 +2660,7 @@ global using nfloat = global::System.Runtime.InteropServices.NFloat%3B <_PostProcessingItem Include="@(_R2RModule->'$([System.IO.Path]::GetFileName($(AppBundleDir)))/$(_AppFrameworksRelativePath)%(FrameworkName).framework/%(FrameworkName)')" Condition="'$(CreateR2RFramework)' == 'true'"> Framework - %(FrameworkName) - %(FrameworkName).framework.dSYM + %(_R2RModule.FrameworkName).framework.dSYM diff --git a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt index d8e0d2301a6c..da65579a4319 100644 --- a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt @@ -1,33 +1,33 @@ -AppBundleSize: 13,259,886 bytes (12,949.1 KB = 12.6 MB) +AppBundleSize: 13,233,325 bytes (12,923.2 KB = 12.6 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 11,733 bytes (11.5 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) Frameworks/libcoreclr.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libcoreclr.framework/Info.plist: 833 bytes (0.8 KB = 0.0 MB) +Frameworks/libcoreclr.framework/Info.plist: 840 bytes (0.8 KB = 0.0 MB) Frameworks/libcoreclr.framework/libcoreclr: 5,220,544 bytes (5,098.2 KB = 5.0 MB) Frameworks/libSystem.Globalization.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Globalization.Native.framework/Info.plist: 875 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.Globalization.Native.framework/libSystem.Globalization.Native: 109,248 bytes (106.7 KB = 0.1 MB) +Frameworks/libSystem.Globalization.Native.framework/Info.plist: 882 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Globalization.Native.framework/libSystem.Globalization.Native: 109,232 bytes (106.7 KB = 0.1 MB) Frameworks/libSystem.IO.Compression.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 877 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,296 bytes (1,397.8 KB = 1.4 MB) +Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 884 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,280 bytes (1,397.7 KB = 1.4 MB) Frameworks/libSystem.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/Info.plist: 847 bytes (0.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/libSystem.Native: 162,224 bytes (158.4 KB = 0.2 MB) +Frameworks/libSystem.Native.framework/Info.plist: 854 bytes (0.8 KB = 0.0 MB) +Frameworks/libSystem.Native.framework/libSystem.Native: 162,128 bytes (158.3 KB = 0.2 MB) Frameworks/libSystem.Net.Security.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 873 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,016 bytes (86.0 KB = 0.1 MB) +Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 880 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,000 bytes (85.9 KB = 0.1 MB) Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/Info.plist: 903 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/Info.plist: 910 bytes (0.9 KB = 0.0 MB) Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/libSystem.Security.Cryptography.Native.Apple: 194,256 bytes (189.7 KB = 0.2 MB) -Frameworks/SizeTestApp.r2r.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/SizeTestApp.r2r.framework/Info.plist: 845 bytes (0.8 KB = 0.0 MB) -Frameworks/SizeTestApp.r2r.framework/SizeTestApp.r2r: 3,963,168 bytes (3,870.3 KB = 3.8 MB) -Info.plist: 1,161 bytes (1.1 KB = 0.0 MB) +Frameworks/SizeTestApp.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) +Frameworks/SizeTestApp.framework/Info.plist: 843 bytes (0.8 KB = 0.0 MB) +Frameworks/SizeTestApp.framework/SizeTestApp: 3,946,656 bytes (3,854.2 KB = 3.8 MB) +Info.plist: 1,168 bytes (1.1 KB = 0.0 MB) Microsoft.iOS.dll: 98,816 bytes (96.5 KB = 0.1 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,481 bytes (1.4 KB = 0.0 MB) -SizeTestApp: 196,608 bytes (192.0 KB = 0.2 MB) +SizeTestApp: 195,904 bytes (191.3 KB = 0.2 MB) SizeTestApp.dll: 7,680 bytes (7.5 KB = 0.0 MB) System.Collections.Immutable.dll: 13,824 bytes (13.5 KB = 0.0 MB) System.Diagnostics.StackTrace.dll: 7,680 bytes (7.5 KB = 0.0 MB) From 96ec7b60781e76dcb74b0a68dc7d300c81732a84 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sun, 5 Apr 2026 21:55:40 -0700 Subject: [PATCH 7/9] Use full dylib filename as R2R module name The ModuleName metadata should be the full dylib filename (e.g. 'introspection.r2r.dylib') to match the owner_composite_name that the runtime passes to get_native_code_data. Introduce ShortName (e.g. 'introspection') for framework/dylib paths, bundle IDs, and install names. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/targets/Microsoft.Sdk.R2R.targets | 32 +++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/dotnet/targets/Microsoft.Sdk.R2R.targets b/dotnet/targets/Microsoft.Sdk.R2R.targets index b792ffd821b5..371e48f5e66f 100644 --- a/dotnet/targets/Microsoft.Sdk.R2R.targets +++ b/dotnet/targets/Microsoft.Sdk.R2R.targets @@ -174,24 +174,26 @@ We derive the module name from the _ReadyToRunObjectFilesToLink filename. --> <_R2RModule Include="@(_ReadyToRunObjectFilesToLink)"> - - $([System.Text.RegularExpressions.Regex]::Replace ('%(Filename)', '\.r2r$', '')) + + %(Filename)%(Extension) + + $([System.Text.RegularExpressions.Regex]::Replace ('%(Filename)', '\.r2r$', '')) - $([System.Text.RegularExpressions.Regex]::Replace ($([System.Text.RegularExpressions.Regex]::Replace ('%(Filename)', '\.r2r$', '')), '[^a-zA-Z0-9_]', '_')) + $([System.Text.RegularExpressions.Regex]::Replace ('%(Filename)%(Extension)', '[^a-zA-Z0-9_]', '_')) <_R2RModule Update="@(_R2RModule)"> RTR_HEADER_%(SanitizedName) %(NativeLinkerInputPath) - %(ModuleName).r2r - $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r.framework - $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r.framework$(_R2RFrameworkBinaryInfix)/%(ModuleName).r2r - $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r.framework$(_R2RFrameworkResourcesInfix)/Info.plist - $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-structure.stamp - $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-cache.txt - $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-cache.txt.uptodate - $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r.dylib - $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-dylib-cache.txt - $(_R2RModuleIntermediateOutputPath)%(ModuleName).r2r-dylib-cache.txt.uptodate + %(ShortName).r2r + $(_R2RModuleIntermediateOutputPath)%(ShortName).r2r.framework + $(_R2RModuleIntermediateOutputPath)%(ShortName).r2r.framework$(_R2RFrameworkBinaryInfix)/%(ShortName).r2r + $(_R2RModuleIntermediateOutputPath)%(ShortName).r2r.framework$(_R2RFrameworkResourcesInfix)/Info.plist + $(_R2RModuleIntermediateOutputPath)%(ShortName).r2r-structure.stamp + $(_R2RModuleIntermediateOutputPath)%(ShortName).r2r-cache.txt + $(_R2RModuleIntermediateOutputPath)%(ShortName).r2r-cache.txt.uptodate + $(_R2RModuleIntermediateOutputPath)%(ShortName).r2r.dylib + $(_R2RModuleIntermediateOutputPath)%(ShortName).r2r-dylib-cache.txt + $(_R2RModuleIntermediateOutputPath)%(ShortName).r2r-dylib-cache.txt.uptodate @@ -238,7 +240,7 @@ <_CurrentR2RDylibLinkerFlags Include="-Wl,-alias,_RTR_HEADER,_%(_R2RModule.SymbolName)" /> <_CurrentR2RDylibLinkerFlags Include="-Wl,-unexported_symbol,_RTR_HEADER" /> - <_CurrentR2RDylibLinkerFlags Include="-Wl,-install_name,@rpath/%(_R2RModule.ModuleName).r2r.dylib" /> + <_CurrentR2RDylibLinkerFlags Include="-Wl,-install_name,@rpath/%(_R2RModule.ModuleName)" /> Date: Mon, 6 Apr 2026 09:00:49 -0700 Subject: [PATCH 8/9] Update expected sizes --- .../expected/iOS-CoreCLR-R2R-size.txt | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt index da65579a4319..c5f9e025abc1 100644 --- a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt @@ -1,33 +1,33 @@ -AppBundleSize: 13,233,325 bytes (12,923.2 KB = 12.6 MB) +AppBundleSize: 13,258,606 bytes (12,947.9 KB = 12.6 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: _CodeSignature/CodeResources: 11,733 bytes (11.5 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) Frameworks/libcoreclr.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libcoreclr.framework/Info.plist: 840 bytes (0.8 KB = 0.0 MB) +Frameworks/libcoreclr.framework/Info.plist: 797 bytes (0.8 KB = 0.0 MB) Frameworks/libcoreclr.framework/libcoreclr: 5,220,544 bytes (5,098.2 KB = 5.0 MB) Frameworks/libSystem.Globalization.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Globalization.Native.framework/Info.plist: 882 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.Globalization.Native.framework/libSystem.Globalization.Native: 109,232 bytes (106.7 KB = 0.1 MB) +Frameworks/libSystem.Globalization.Native.framework/Info.plist: 839 bytes (0.8 KB = 0.0 MB) +Frameworks/libSystem.Globalization.Native.framework/libSystem.Globalization.Native: 109,248 bytes (106.7 KB = 0.1 MB) Frameworks/libSystem.IO.Compression.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 884 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,280 bytes (1,397.7 KB = 1.4 MB) +Frameworks/libSystem.IO.Compression.Native.framework/Info.plist: 841 bytes (0.8 KB = 0.0 MB) +Frameworks/libSystem.IO.Compression.Native.framework/libSystem.IO.Compression.Native: 1,431,296 bytes (1,397.8 KB = 1.4 MB) Frameworks/libSystem.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/Info.plist: 854 bytes (0.8 KB = 0.0 MB) -Frameworks/libSystem.Native.framework/libSystem.Native: 162,128 bytes (158.3 KB = 0.2 MB) +Frameworks/libSystem.Native.framework/Info.plist: 811 bytes (0.8 KB = 0.0 MB) +Frameworks/libSystem.Native.framework/libSystem.Native: 162,224 bytes (158.4 KB = 0.2 MB) Frameworks/libSystem.Net.Security.Native.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 880 bytes (0.9 KB = 0.0 MB) -Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,000 bytes (85.9 KB = 0.1 MB) +Frameworks/libSystem.Net.Security.Native.framework/Info.plist: 837 bytes (0.8 KB = 0.0 MB) +Frameworks/libSystem.Net.Security.Native.framework/libSystem.Net.Security.Native: 88,016 bytes (86.0 KB = 0.1 MB) Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/Info.plist: 910 bytes (0.9 KB = 0.0 MB) +Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/Info.plist: 867 bytes (0.8 KB = 0.0 MB) Frameworks/libSystem.Security.Cryptography.Native.Apple.framework/libSystem.Security.Cryptography.Native.Apple: 194,256 bytes (189.7 KB = 0.2 MB) -Frameworks/SizeTestApp.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) -Frameworks/SizeTestApp.framework/Info.plist: 843 bytes (0.8 KB = 0.0 MB) -Frameworks/SizeTestApp.framework/SizeTestApp: 3,946,656 bytes (3,854.2 KB = 3.8 MB) -Info.plist: 1,168 bytes (1.1 KB = 0.0 MB) -Microsoft.iOS.dll: 98,816 bytes (96.5 KB = 0.1 MB) +Frameworks/SizeTestApp.r2r.framework/_CodeSignature/CodeResources: 1,798 bytes (1.8 KB = 0.0 MB) +Frameworks/SizeTestApp.r2r.framework/Info.plist: 809 bytes (0.8 KB = 0.0 MB) +Frameworks/SizeTestApp.r2r.framework/SizeTestApp.r2r: 3,963,184 bytes (3,870.3 KB = 3.8 MB) +Info.plist: 1,125 bytes (1.1 KB = 0.0 MB) +Microsoft.iOS.dll: 98,304 bytes (96.0 KB = 0.1 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,481 bytes (1.4 KB = 0.0 MB) -SizeTestApp: 195,904 bytes (191.3 KB = 0.2 MB) +SizeTestApp: 196,112 bytes (191.5 KB = 0.2 MB) SizeTestApp.dll: 7,680 bytes (7.5 KB = 0.0 MB) System.Collections.Immutable.dll: 13,824 bytes (13.5 KB = 0.0 MB) System.Diagnostics.StackTrace.dll: 7,680 bytes (7.5 KB = 0.0 MB) From 550f56d8bd2f1d4a0c62b808081355f6d03bf49a Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 6 Apr 2026 13:43:32 -0700 Subject: [PATCH 9/9] Support Windows remote builds for R2R module registration GenerateR2RModuleRegistration now implements ITaskCallback and supports remote execution via SessionId. When building from Windows, the task executes on the remote Mac so that r2r_modules.mm is created where CompileNativeCode can find it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/targets/Microsoft.Sdk.R2R.targets | 1 + .../Tasks/GenerateR2RModuleRegistration.cs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dotnet/targets/Microsoft.Sdk.R2R.targets b/dotnet/targets/Microsoft.Sdk.R2R.targets index 371e48f5e66f..2b38ae39547d 100644 --- a/dotnet/targets/Microsoft.Sdk.R2R.targets +++ b/dotnet/targets/Microsoft.Sdk.R2R.targets @@ -340,6 +340,7 @@ > diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs index a593b52d65a6..c6f4f11a8fd2 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs @@ -1,12 +1,17 @@ using System.IO; +using System.Linq; +using System.Collections.Generic; using System.Text; using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +using Xamarin.Messaging.Build.Client; #nullable enable namespace Xamarin.MacDev.Tasks { - public class GenerateR2RModuleRegistration : XamarinTask { + public class GenerateR2RModuleRegistration : XamarinTask, ITaskCallback { #region Inputs [Required] @@ -18,6 +23,9 @@ public class GenerateR2RModuleRegistration : XamarinTask { public override bool Execute () { + if (ShouldExecuteRemotely ()) + return ExecuteRemotely (); + var sb = new StringBuilder (); sb.AppendLine ("#include \"xamarin/xamarin.h\""); @@ -71,5 +79,11 @@ public override bool Execute () return !Log.HasLoggedErrors; } + + public bool ShouldCopyToBuildServer (ITaskItem item) => false; + + public bool ShouldCreateOutputFile (ITaskItem item) => true; + + public IEnumerable GetAdditionalItemsToBeCopied () => Enumerable.Empty (); } }