Skip to content

Commit

Permalink
Try to fix _DefaultLinkMode for NativeAOT.
Browse files Browse the repository at this point in the history
  • Loading branch information
filipnavara committed Jul 17, 2023
1 parent b68efbe commit 323b1e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1219,9 +1219,6 @@
<UnmanagedEntryPointsAssembly Remove="System.Private.CoreLib" />
<UnmanagedEntryPointsAssembly Include="@(_UpdatedManagedAssemblyToLink->'%(Filename)')" />

<!-- Disable trimming by default (assemblies aren't trimmed unless they're marked IsTrimmable) -->
<IlcArg Include="--defaultrooting" />

<!-- Link in the output from ILC -->
<_NativeExecutableObjectFiles Include="$(NativeObject)" />

Expand Down Expand Up @@ -1615,7 +1612,10 @@
<_DefaultLinkMode>TrimMode</_DefaultLinkMode>
</PropertyGroup>
<PropertyGroup Condition="'$(TrimMode)' == ''">
<_DefaultLinkMode Condition="'$(_UseNativeAot)' != 'true'">Full</_DefaultLinkMode> <!-- Linking is always on for all assemblies when using NativeAOT - this is because we need to modify all assemblies in the linker for them to be compatible with NativeAOT -->
<!-- Linking is always on for all assemblies when using NativeAOT - this is because we need to modify all assemblies in the linker for them to be compatible with NativeAOT -->
<_DefaultLinkMode Condition="'$(_UseNativeAot)' == 'true' And '$(_PlatformName)' == 'macOS'">Full</_DefaultLinkMode>
<_DefaultLinkMode Condition="'$(_UseNativeAot)' == 'true' And '$(_PlatformName)' != 'macOS'">SdkOnly</_DefaultLinkMode>

<_DefaultLinkMode Condition="'$(_UseNativeAot)' != 'true' And '$(_PlatformName)' == 'macOS'">None</_DefaultLinkMode> <!-- Linking is off by default for macOS apps -->
<_DefaultLinkMode Condition="'$(_UseNativeAot)' != 'true' And '$(_PlatformName)' == 'MacCatalyst' And '$(Configuration)' == 'Release'">SdkOnly</_DefaultLinkMode> <!-- Default linking is on for release builds for Mac Catalyst apps -->
<_DefaultLinkMode Condition="'$(_UseNativeAot)' != 'true' And '$(_PlatformName)' == 'MacCatalyst' And '$(Configuration)' != 'Release'">None</_DefaultLinkMode> <!-- Default linking is off for non-release builds for Mac Catalyst apps -->
Expand Down

0 comments on commit 323b1e4

Please sign in to comment.