Skip to content

Commit

Permalink
Add support for llvm linker (lld)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Jan 13, 2023
1 parent da2c147 commit 8f489de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)' != ''" />
Expand Down Expand Up @@ -183,5 +184,12 @@ The .NET Foundation licenses this file to you under the MIT license.
<PropertyGroup Condition="'$(TargetOS)' == 'osx' and '$(StripSymbols)' == 'true' and $(_DsymUtilOutput.Contains('--minimize'))">
<DsymUtilOptions>$(DsymUtilOptions) --minimize</DsymUtilOptions>
</PropertyGroup>

<Exec Command="echo &quot;int main(void){}&quot; | &quot;$(CppCompilerAndLinker)&quot; -fuse-ld=lld -xc -o /dev/null -" IgnoreExitCode="true" StandardOutputImportance="Low" StandardErrorImportance="low" Condition="'$(UseLLVMLinker)' == 'true'">
<Output TaskParameter="ExitCode" PropertyName="_LLDAvailable" />
</Exec>

<Error Condition="'$(UseLLVMLinker)' == 'true' and '$(_LLDAvailable)' != '0'"
Text="LLVM linker (lld) was requested, but it wasn't found by the compiler driver '$(CppCompilerAndLinker)'" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -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'" />
Expand Down

0 comments on commit 8f489de

Please sign in to comment.