<Error Condition="'$(_WhereLinker)' != '0' and '$(CppCompilerAndLinkerAlternative)' == '' and '$(_IsApplePlatform)' != 'true'"
Text="Requested linker ('$(CppLinker)') not found in PATH." />
+ <Exec Command=""$(CppLinker)" -fuse-ld=lld -Wl,--version" Condition="'$(LinkerFlavor)' == 'lld'" IgnoreExitCode="true" StandardOutputImportance="Low" ConsoleToMSBuild="true">
+ <Output TaskParameter="ExitCode" PropertyName="_LinkerVersionStringExitCode" />
+ <Output TaskParameter="ConsoleOutput" PropertyName="_LinkerVersionString" />
+ </Exec>
+
+ <PropertyGroup Condition="'$(_LinkerVersionStringExitCode)' == '0' and '$(_LinkerVersionString)' != ''">
+ <_LinkerVersion>$([System.Text.RegularExpressions.Regex]::Match($(_LinkerVersionString), '[1-9]\d*'))</_LinkerVersion>
+ </PropertyGroup>
+
<Exec Command="command -v "$(ObjCopyName)"" IgnoreExitCode="true" StandardOutputImportance="Low" Condition="'$(_IsApplePlatform)' != 'true' and '$(StripSymbols)' == 'true'">
<Output TaskParameter="ExitCode" PropertyName="_WhereSymbolStripper" />
</Exec>
</ItemGroup>
<ItemGroup Condition="'$(_targetOS)' != 'win' and '$(_IsApplePlatform)' != 'true'">
<CustomLinkerArg Include="-Wl,--discard-all" />
- <CustomLinkerArg Include="-Wl,--gc-sections" Condition="'$(LinkerFlavor)' == '' or '$(LinkerFlavor)' == 'bfd'" />
+ <CustomLinkerArg Include="-Wl,--gc-sections" Condition="'$(LinkerFlavor)' == '' or '$(LinkerFlavor)' == 'bfd' or '$(LinkerFlavor)' == 'lld'" />
+ <CustomLinkerArg Include="-Wl,-T,"$(NativeIntermediateOutputPath)sections.ld"" Condition="'$(LinkerFlavor)' == 'lld' and '$(_LinkerVersion)' > '12'" />
</ItemGroup>
<ItemGroup>
<CustomLibArg Include="-crs "$(NativeBinary)"" Condition="'$(_targetOS)' != 'win'" />
<StripFlag Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' == 'Shared'">-x</StripFlag> <!-- keep global symbols in dylib -->
</PropertyGroup>
+ <!-- write linker script for lld (13+) to retain the __modules section -->
+ <WriteLinesToFile File="$(NativeIntermediateOutputPath)sections.ld" Lines="OVERWRITE_SECTIONS { __modules : { KEEP(*(__modules)) } }" Overwrite="true" Condition="'$(LinkerFlavor)' == 'lld' and '$(_LinkerVersion)' > '12'" />
+
<Exec Command=""$(CppLinker)" @(CustomLinkerArg, ' ')" Condition="'$(_targetOS)' != 'win' and '$(NativeLib)' != 'Static'" IgnoreStandardErrorWarningFormat="$(_IgnoreLinkerWarnings)" />
<Exec Command=""$(CppLibCreator)" @(CustomLibArg, ' ')" Condition="'$(_targetOS)' != 'win' and '$(NativeLib)' == 'Static'" />
const int MinWarnings = 16500;
const int MaxWarnings = 18500;
#else
- const int MinWarnings = 9500;
- const int MaxWarnings = 10500;
+ const int MinWarnings = 12000;
+ const int MaxWarnings = 13000;
#endif
int count = 0;
string line;