Skip to content

Commit

Permalink
[NativeAOT] Do not strip exported symbols from executables on Apple p…
Browse files Browse the repository at this point in the history
…latforms (#85293)

* Do not strip exported symbols from executables when explicitly specified

* Add '_' prefix to StripFlag internal project property
  • Loading branch information
ivanpovazan authored Apr 25, 2023
1 parent de195af commit 32ecd85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ The .NET Foundation licenses this file to you under the MIT license.
<PropertyGroup>
<_IgnoreLinkerWarnings>false</_IgnoreLinkerWarnings>
<_IgnoreLinkerWarnings Condition="'$(_IsApplePlatform)' == 'true'">true</_IgnoreLinkerWarnings>
<StripFlag Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' == 'Shared'">-x</StripFlag> <!-- keep global symbols in dylib -->
<_StripFlag Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' == 'Shared'">-x</_StripFlag> <!-- keep global symbols in dylib -->
<_StripFlag Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' != 'Shared' and '$(IlcExportUnmanagedEntrypoints)' == 'true'">-i -s $(ExportsFile)</_StripFlag> <!-- keep global symbols when explicitly specified -->
</PropertyGroup>

<!-- write linker script for lld (13+) to retain the __modules section -->
Expand All @@ -362,7 +363,7 @@ The .NET Foundation licenses this file to you under the MIT license.
<Exec Condition="'$(StripSymbols)' == 'true' and '$(_IsApplePlatform)' == 'true' and '$(NativeLib)' != 'Static'"
Command="
dsymutil $(DsymUtilOptions) &quot;$(NativeBinary)&quot; &amp;&amp;
strip -no_code_signature_warning $(StripFlag) &quot;$(NativeBinary)&quot;" />
strip -no_code_signature_warning $(_StripFlag) &quot;$(NativeBinary)&quot;" />
</Target>

<Target Name="CreateLib"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<CLRTestKind>BuildAndRun</CLRTestKind>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IlcExportUnmanagedEntrypoints>true</IlcExportUnmanagedEntrypoints>

<!-- Stripping symbols causes problems for running the test on macOS -->
<StripSymbols>false</StripSymbols>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 32ecd85

Please sign in to comment.