Skip to content

Commit

Permalink
Enable native AOT for non-portable crossgen2
Browse files Browse the repository at this point in the history
- Add a breadcrumb for non-portable build into the Native AOT runtime pack
- Use the breadcrumb to add system OpenSSL libs to the linker command
  line

Contributes to dotnet#66859
  • Loading branch information
jkotas committed Jan 26, 2024
1 parent 0d81a5a commit 6a6caf3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/coreclr/nativeaot/BuildIntegration/BuildIntegration.proj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
<WriteLinesToFile
File="$(RuntimeBinDir)/aotsdk/debugucrt.txt"
Condition="'$(TargetsWindows)'=='true' and '$(Configuration)' != 'Release'" />

<!-- Create breadcrumb to add additional libraries for non-portable builds -->
<WriteLinesToFile
File="$(RuntimeBinDir)/aotsdk/nonportable.txt"
Condition="'$(TargetsWindows)'!='true' and '$(PortableBuild)' != 'true'" />
</Target>

<Target Name="Restore" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ The .NET Foundation licenses this file to you under the MIT license.
<StaticICULibs Include="-Wl,-Bdynamic" Condition="'$(StaticExecutable)' != 'true'" />
</ItemGroup>

<ItemGroup Condition="'$(StaticOpenSslLinking)' != 'true' and Exists('$(IlcSdkPath)nonportable.txt')">
<NativeSystemLibrary Include="ssl" />
<NativeSystemLibrary Include="crypto" />
</ItemGroup>

<ItemGroup Condition="'$(StaticOpenSslLinking)' == 'true' and '$(NativeLib)' != 'Static'">
<NativeLibrary Include="$(IntermediateOutputPath)libs/System.Security.Cryptography.Native/build/libSystem.Security.Cryptography.Native.OpenSsl.a" />
<DirectPInvoke Include="libSystem.Security.Cryptography.Native.OpenSsl" />
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<!-- Can't use NativeAOT in non-portable build yet https://github.com/dotnet/runtime/issues/66859 -->
<NativeAotSupported Condition="'$(PortableBuild)' != 'true'">false</NativeAotSupported>
<NativeAotSupported Condition="$(OutputRID.StartsWith('tizen')) == 'true'">false</NativeAotSupported>
<NativeAotSupported Condition="$(OutputRID.EndsWith('-arm')) == 'true'">false</NativeAotSupported>
<!-- Publish crossgen2 as a single-file app on native-OS builds. Cross-OS NativeAOT compilation is not supported yet -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<ShouldVerifyClosure>false</ShouldVerifyClosure>
<!-- Publish crossgen2 as a single-file app on native-OS builds. Cross-OS NativeAOT compilation is not supported yet -->
<NativeAotSupported Condition="'$(CrossBuild)' == 'true' and '$(TargetOS)' != '$(HostOS)'">false</NativeAotSupported>
<!-- Can't use NativeAOT in source build yet https://github.com/dotnet/runtime/issues/66859 -->
<NativeAotSupported Condition="'$(DotNetBuildFromSource)' == 'true'">false</NativeAotSupported>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 6a6caf3

Please sign in to comment.