Add support for llvm linker (lld) (#80613)
authorAdeel Mujahid <3840695+am11@users.noreply.github.com>
Sat, 14 Jan 2023 22:23:46 +0000 (00:23 +0200)
committerGitHub <noreply@github.com>
Sat, 14 Jan 2023 22:23:46 +0000 (14:23 -0800)
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets

index b55c7bd92a693121647cfb22ae38f3e21e3a08a2..3edc4be7ea3db45bf537b3df038c44aa172bbcef 100644 (file)
@@ -88,6 +88,7 @@ The .NET Foundation licenses this file to you under the MIT license.
     <Exec Command="$(IlcHostPackagePath)/native/src/libs/System.Globalization.Native/local_build.sh $(IlcHostPackagePath)/ $(IntermediateOutputPath)" Condition="'$(StaticICULinking)' == 'true'"/>
 
     <ItemGroup>
+      <LinkerArg Include="-fuse-ld=lld" Condition="'$(UseLLVMLinker)' == 'true'" />
       <LinkerArg Include="-static" Condition="'$(StaticExecutable)' == 'true'" />
       <LinkerArg Include="@(NativeLibrary)" />
       <LinkerArg Include="--sysroot=$(SysRoot)" Condition="'$(SysRoot)' != ''" />
index fe12a04fe1f2e0cbe98ddb5b4f2fd8d67cb96011..2e134e663a493bed357d8a221fe160c40e222b39 100755 (executable)
@@ -330,7 +330,7 @@ The .NET Foundation licenses this file to you under the MIT license.
     </ItemGroup>
     <ItemGroup Condition="'$(TargetOS)' != 'windows' and '$(TargetOS)' != 'osx'">
       <CustomLinkerArg Include="-Wl,--discard-all" />
-      <CustomLinkerArg Include="-Wl,--gc-sections" />
+      <CustomLinkerArg Include="-Wl,--gc-sections" Condition="'$(UseLLVMLinker)' != 'true'" />
     </ItemGroup>
     <ItemGroup>
       <CustomLibArg Include="-crs &quot;$(NativeBinary)&quot;" Condition="'$(TargetOS)' != 'windows'" />