Skip to content

Commit b3c3921

Browse files
authored
Defer objcopy selection after alt. compiler check (#71554)
In the environment where `gcc` is auto-detected (during `SetupOSSpecificProps` target execution), we should be selecting binutils' `objcopy`, rather than `llvm-objcopy`.
1 parent f54ec72 commit b3c3921

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ The .NET Foundation licenses this file to you under the MIT license.
2020
<CppLinker>$(CppCompilerAndLinker)</CppLinker>
2121
<CppLibCreator>ar</CppLibCreator>
2222
<DsymUtilOptions Condition="'$(TargetOS)' == 'OSX'">--flat</DsymUtilOptions>
23-
<ObjCopyName Condition="'$(ObjCopyName)' == '' and '$(TargetOS)' != 'OSX' and '$(CppCompilerAndLinker)' != 'clang'">objcopy</ObjCopyName>
24-
<ObjCopyName Condition="'$(ObjCopyName)' == '' and '$(TargetOS)' != 'OSX' and '$(CppCompilerAndLinker)' == 'clang'">llvm-objcopy</ObjCopyName>
2523
</PropertyGroup>
2624

2725
<Target Name="SetupOSSpecificProps" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
@@ -120,6 +118,11 @@ The .NET Foundation licenses this file to you under the MIT license.
120118
<_WhereLinker>0</_WhereLinker>
121119
</PropertyGroup>
122120

121+
<PropertyGroup Condition="'$(ObjCopyName)' == '' and '$(TargetOS)' != 'OSX'">
122+
<ObjCopyName Condition="'$(CppCompilerAndLinker)' != 'clang'">objcopy</ObjCopyName>
123+
<ObjCopyName Condition="'$(CppCompilerAndLinker)' == 'clang'">llvm-objcopy</ObjCopyName>
124+
</PropertyGroup>
125+
123126
<Error Condition="'$(_WhereLinker)' != '0' and '$(TargetOS)' == 'OSX'" Text="Platform linker ('$(CppLinker)') not found in PATH. Try installing Xcode to resolve the problem." />
124127
<Error Condition="'$(_WhereLinker)' != '0' and '$(CppCompilerAndLinkerAlternative)' != ''"
125128
Text="Platform linker ('$(CppLinker)' or '$(CppCompilerAndLinkerAlternative)') not found in PATH. Try installing appropriate package for $(CppLinker) or $(CppCompilerAndLinkerAlternative) to resolve the problem." />

0 commit comments

Comments
 (0)