Skip to content

Commit

Permalink
[NativeAOT] Enable dynamic linking of ucrt for release runtime (#71182)
Browse files Browse the repository at this point in the history
This is enabled for release runtime only, same as how we do it for regular CoreCLR builds.
  • Loading branch information
jkotas committed Jun 23, 2022
1 parent a73c582 commit 05ae801
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/coreclr/nativeaot/BuildIntegration/BuildIntegration.proj
Expand Up @@ -11,6 +11,11 @@

<Target Name="Build">
<Copy SourceFiles="@(Content)" DestinationFolder="$(OutputPath)" />

<!-- Create breadcrumb to disable dynamic linking of release crt for debug runtime -->
<WriteLinesToFile
File="$(RuntimeBinDir)/aotsdk/debugucrt.txt"
Condition="'$(TargetsWindows)'=='true' and '$(Configuration)' != 'Release'" />
</Target>

<Target Name="Restore" />
Expand Down
Expand Up @@ -86,6 +86,12 @@ The .NET Foundation licenses this file to you under the MIT license.
<LinkerArg Condition="'$(ControlFlowGuard)' == 'Guard'" Include="/guard:cf" />
</ItemGroup>

<ItemGroup Condition="!Exists('$(IlcSdkPath)debugucrt.txt')">
<!-- Force ucrt to be dynamically linked for release runtime -->
<LinkerArg Include="/NODEFAULTLIB:libucrt.lib" />
<LinkerArg Include="/DEFAULTLIB:ucrt.lib" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' != 'Debug'">
<LinkerArg Include="/OPT:REF" />
<LinkerArg Include="/OPT:ICF" />
Expand Down

0 comments on commit 05ae801

Please sign in to comment.