File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/coreclr/nativeaot/BuildIntegration Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,8 @@ The .NET Foundation licenses this file to you under the MIT license.
318318 </ItemGroup >
319319 <ItemGroup Condition =" '$(_targetOS)' != 'win' and '$(_IsApplePlatform)' != 'true'" >
320320 <CustomLinkerArg Include =" -Wl,--discard-all" />
321- <CustomLinkerArg Include =" -Wl,--gc-sections" Condition =" '$(LinkerFlavor)' == '' or '$(LinkerFlavor)' == 'bfd'" />
321+ <CustomLinkerArg Include =" -Wl,--gc-sections" Condition =" '$(LinkerFlavor)' == '' or '$(LinkerFlavor)' == 'bfd' or '$(LinkerFlavor)' == 'lld'" />
322+ <CustomLinkerArg Include =" -Wl,-T," $(NativeIntermediateOutputPath)sections.ld" " Condition =" '$(LinkerFlavor)' == 'lld'" />
322323 </ItemGroup >
323324 <ItemGroup >
324325 <CustomLibArg Include =" -crs " $(NativeBinary)" " Condition =" '$(_targetOS)' != 'win'" />
@@ -335,6 +336,9 @@ The .NET Foundation licenses this file to you under the MIT license.
335336 <StripFlag Condition =" '$(_IsApplePlatform)' == 'true' and '$(NativeLib)' == 'Shared'" >-x</StripFlag > <!-- keep global symbols in dylib -->
336337 </PropertyGroup >
337338
339+ <!-- write linker script for lld to retain the __modules section -->
340+ <WriteLinesToFile File =" $(NativeIntermediateOutputPath)sections.ld" Lines =" OVERWRITE_SECTIONS { __modules : { KEEP(*(__modules)) } }" Overwrite =" true" Condition =" '$(LinkerFlavor)' == 'lld'" />
341+
338342 <Exec Command =" " $(CppLinker)" @(CustomLinkerArg, ' ')" Condition =" '$(_targetOS)' != 'win' and '$(NativeLib)' != 'Static'" IgnoreStandardErrorWarningFormat =" $(_IgnoreLinkerWarnings)" />
339343 <Exec Command =" " $(CppLibCreator)" @(CustomLibArg, ' ')" Condition =" '$(_targetOS)' != 'win' and '$(NativeLib)' == 'Static'" />
340344
You can’t perform that action at this time.
0 commit comments