Skip to content

Commit bd471dc

Browse files
Split off system libraries into a separate ItemGroup (#89916)
Should help with #88294 (comment).
1 parent 643087b commit bd471dc

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

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

+19-11
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,23 @@ The .NET Foundation licenses this file to you under the MIT license.
105105
<NativeFramework Condition="!$(_targetOS.StartsWith('tvos'))" Include="GSS" />
106106
</ItemGroup>
107107

108+
<ItemGroup>
109+
<NativeSystemLibrary Include="stdc++" Condition="'$(LinkStandardCPlusPlusLibrary)' == 'true'" />
110+
<NativeSystemLibrary Include="dl" />
111+
<NativeSystemLibrary Include="objc" Condition="'$(_IsApplePlatform)' == 'true'" />
112+
<NativeSystemLibrary Include="swiftCore" Condition="'$(_targetOS)' == 'osx'" />
113+
<NativeSystemLibrary Include="swiftFoundation" Condition="'$(_targetOS)' == 'osx'" />
114+
<NativeSystemLibrary Include="z" />
115+
<NativeSystemLibrary Include="rt" Condition="'$(_IsApplePlatform)' != 'true' and '$(_linuxLibcFlavor)' != 'bionic'" />
116+
<NativeSystemLibrary Include="log" Condition="'$(_linuxLibcFlavor)' == 'bionic'" />
117+
<NativeSystemLibrary Include="icucore" Condition="'$(_IsApplePlatform)' == 'true'" />
118+
<NativeSystemLibrary Include="m" />
119+
</ItemGroup>
120+
121+
<ItemGroup>
122+
<ExtraLinkerArg Include="-segprot,__THUNKS,rx,rx" Condition="'$(_IsiOSLikePlatform)' == 'true'" />
123+
</ItemGroup>
124+
108125
<ItemGroup>
109126
<LinkerArg Include="-gz=zlib" Condition="'$(CompressSymbols)' != 'false'" />
110127
<LinkerArg Include="-fuse-ld=$(LinkerFlavor)" Condition="'$(LinkerFlavor)' != ''" />
@@ -120,19 +137,10 @@ The .NET Foundation licenses this file to you under the MIT license.
120137
<LinkerArg Include="-Wl,--as-needed" Condition="'$(_IsApplePlatform)' != 'true'" />
121138
<LinkerArg Include="-Wl,-e0x0" Condition="'$(NativeLib)' == 'Shared' and '$(_IsApplePlatform)' != 'true'" />
122139
<LinkerArg Include="-pthread" Condition="'$(_IsApplePlatform)' != 'true'" />
123-
<LinkerArg Include="-lstdc++" Condition="'$(LinkStandardCPlusPlusLibrary)' == 'true'" />
124-
<LinkerArg Include="-ldl" />
125-
<LinkerArg Include="-lobjc" Condition="'$(_IsApplePlatform)' == 'true'" />
126-
<LinkerArg Include="-lswiftCore" Condition="'$(_targetOS)' == 'osx'" />
127-
<LinkerArg Include="-lswiftFoundation" Condition="'$(_targetOS)' == 'osx'" />
128-
<LinkerArg Include="-lz" />
129-
<LinkerArg Include="-lrt" Condition="'$(_IsApplePlatform)' != 'true' and '$(_linuxLibcFlavor)' != 'bionic'" />
130-
<LinkerArg Include="-llog" Condition="'$(_linuxLibcFlavor)' == 'bionic'" />
131-
<LinkerArg Include="-licucore" Condition="'$(_IsApplePlatform)' == 'true'" />
140+
<LinkerArg Include="@(NativeSystemLibrary->'-l%(Identity)')" />
132141
<LinkerArg Include="-L/usr/lib/swift" Condition="'$(_targetOS)' == 'osx'" />
133142
<LinkerArg Include="@(StaticICULibs)" Condition="'$(StaticICULinking)' == 'true'" />
134143
<LinkerArg Include="@(StaticSslLibs)" Condition="'$(StaticOpenSslLinking)' == 'true'" />
135-
<LinkerArg Include="-lm" />
136144
<LinkerArg Include="-static" Condition="'$(StaticExecutable)' == 'true' and '$(PositionIndependentExecutable)' == 'false'" />
137145
<LinkerArg Include="-static-pie" Condition="'$(StaticExecutable)' == 'true' and '$(PositionIndependentExecutable)' != 'false'" />
138146
<LinkerArg Include="-dynamiclib" Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' == 'Shared'" />
@@ -152,7 +160,7 @@ The .NET Foundation licenses this file to you under the MIT license.
152160
<LinkerArg Include="-L/usr/local/lib -lgssapi_krb5" Condition="'$(_targetOS)' == 'freebsd'" />
153161
<!-- FreeBSD's inotify is an installed package and not found in default libraries -->
154162
<LinkerArg Include="-L/usr/local/lib -linotify" Condition="'$(_targetOS)' == 'freebsd'" />
155-
<LinkerArg Include="-Wl,-segprot,__THUNKS,rx,rx" Condition="'$(_IsiOSLikePlatform)' == 'true'" />
163+
<LinkerArg Include="@(ExtraLinkerArg->'-Wl,%(Identity)')" />
156164
<LinkerArg Include="@(NativeFramework->'-framework %(Identity)')" Condition="'$(_IsApplePlatform)' == 'true'" />
157165
<LinkerArg Include="-Wl,--eh-frame-hdr" Condition="'$(_IsApplePlatform)' != 'true'" />
158166
</ItemGroup>

0 commit comments

Comments
 (0)