Skip to content

Commit fc08df1

Browse files
authored
[NativeAOT] Pass the minimum macOS version to the linker (#98233)
* [NativeAOT] Pass the minimum macOS version to the linker * Use target triple for macOS
1 parent 36b18a3 commit fc08df1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets

+7-2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ The .NET Foundation licenses this file to you under the MIT license.
8383
<SharedLibraryInstallName Condition="'$(SharedLibraryInstallName)' == '' and '$(NativeLib)' == 'Shared'">@rpath/$(TargetName)$(NativeBinaryExt)</SharedLibraryInstallName>
8484
</PropertyGroup>
8585

86+
<PropertyGroup Condition="'$(_targetOS)' == 'osx'">
87+
<AppleMinOSVersion Condition="'$(AppleMinOSVersion)' == ''">11.0</AppleMinOSVersion>
88+
<TargetTriple Condition="'$(_targetArchitecture)' == 'x64'">x86_64-apple-macos$(AppleMinOSVersion)</TargetTriple>
89+
<TargetTriple Condition="'$(_targetArchitecture)' == 'arm64'">arm64-apple-macos$(AppleMinOSVersion)</TargetTriple>
90+
</PropertyGroup>
91+
8692
<Error Condition="'$(_IsiOSLikePlatform)' == 'true' and ('$(_AppleSdkName)' == '' or '$(CrossCompileArch)' == '' or '$(_AppleTripleOS)' == '' or '$(AppleMinOSVersion)' == '' or '$(_AppleTripleAbi)' == '')"
8793
Text="One of the required Apple SDK properties is empty and was not properly resolved: _AppleSdkName = '$(_AppleSdkName)' CrossCompileArch = '$(CrossCompileArch)' _AppleTripleOS = '$(_AppleTripleOS)' AppleMinOSVersion = '$(AppleMinOSVersion)' _AppleTripleAbi = '$(_AppleTripleAbi)'" />
8894

@@ -183,8 +189,7 @@ The .NET Foundation licenses this file to you under the MIT license.
183189
<LinkerArg Include="@(NativeLibrary)" />
184190
<LinkerArg Include="--sysroot=&quot;$(SysRoot)&quot;" Condition="'$(SysRoot)' != '' and '$(_IsApplePlatform)' != 'true'" />
185191
<LinkerArg Include="-isysroot &quot;$(SysRoot)&quot;" Condition="'$(SysRoot)' != '' and '$(_IsApplePlatform)' == 'true'" />
186-
<LinkerArg Include="--target=$(TargetTriple)" Condition="'$(_targetOS)' != 'osx' and '$(TargetTriple)' != ''" />
187-
<LinkerArg Include="-arch $(CrossCompileArch)" Condition="'$(_IsApplePlatform)' == 'true' and '$(CrossCompileArch)' != ''" />
192+
<LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetTriple)' != ''" />
188193
<LinkerArg Include="-g" Condition="$(NativeDebugSymbols) == 'true'" />
189194
<LinkerArg Include="-Wl,--strip-debug" Condition="$(NativeDebugSymbols) != 'true' and '$(_IsApplePlatform)' != 'true'" />
190195
<LinkerArg Include="-Wl,-rpath,'$(IlcRPath)'" Condition="'$(StaticExecutable)' != 'true' and !$([MSBuild]::IsOSPlatform('Windows'))" />

0 commit comments

Comments
 (0)