Skip to content

Re-enable symbol stripping for Apple platforms#124266

Open
kotlarmilos wants to merge 18 commits intodotnet:mainfrom
kotlarmilos:bugfix/enable-strip-symbols
Open

Re-enable symbol stripping for Apple platforms#124266
kotlarmilos wants to merge 18 commits intodotnet:mainfrom
kotlarmilos:bugfix/enable-strip-symbols

Conversation

@kotlarmilos
Copy link
Copy Markdown
Member

@kotlarmilos kotlarmilos commented Feb 11, 2026

Description

Re-enables symbol stripping for Apple platforms by removing the StripSymbols=false workarounds from ILCompiler_publish.csproj, crossgen2_publish.csproj, ilasm.csproj, and XUnitLogChecker.csproj. Apple's pre-built Swift runtime static libraries contain DWARF debug info with -gmodules references to .pcm module cache files that only existed on Apple's build machines, causing dsymutil to output error: messages even though it exits with code 0.

To handle this, IgnoreStandardErrorWarningFormat="true" is added to the dsymutil Exec tasks in Microsoft.NETCore.Native.targets, Microsoft.NET.CrossGen.targets, and native-library.targets, preventing MSBuild from incorrectly counting these output lines as build errors while still catching real failures via non-zero exit codes.

Additionally, Apple platform detection in eng/toolAot.targets is fixed by using PortableOS instead of _IsApplePlatform (which is unavailable at that evaluation point) and broadening the condition to UseNativeAotForComponents to cover components like XUnitLogChecker that set PublishAot directly.

Fixes #123687

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR re-enables symbol stripping for Apple platforms by removing a temporary workaround that was added in PR #123386. The workaround disabled symbol stripping (StripSymbols=false) to avoid dsymutil module cache errors that occurred when Swift code was compiled with -g (full debug info). Now that the underlying Swift compilation has been fixed to use -gline-tables-only instead, symbol stripping can be safely re-enabled.

Changes:

  • Removes StripSymbols=false workaround from three .csproj files (ILCompiler, crossgen2, and XUnitLogChecker)
  • Adds symbol stripping logic to the CrossGen2 test script for Apple mobile runtime tests

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/coreclr/tools/aot/ILCompiler/ILCompiler_publish.csproj Removes the StripSymbols=false workaround, allowing default symbol stripping behavior to apply
src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj Removes the StripSymbols=false workaround, allowing default symbol stripping behavior to apply
src/tests/Common/XUnitLogChecker/XUnitLogChecker.csproj Removes the StripSymbols=false workaround, allowing default symbol stripping behavior to apply
src/tests/Common/CLRTest.CrossGen.targets Adds symbol stripping command after linking for Mach-O format outputs when StripSymbols is true

Copilot AI review requested due to automatic review settings February 27, 2026 09:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

@kotlarmilos
Copy link
Copy Markdown
Member Author

The macOS jobs are still reporting missing module cache files (.pcm).

Copilot AI review requested due to automatic review settings March 4, 2026 13:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.


You can also share your feedback on Copilot code review. Take the survey.

kotlarmilos and others added 2 commits March 18, 2026 10:53
dsymutil outputs 'error: <path>.pcm: No such file or directory' messages
to stdout (not stderr) when processing binaries linked against Apple's
Swift runtime static libraries. The previous 2>/dev/null only suppressed
stderr, leaving stdout errors visible to MSBuild's error pattern matching.

Change to >/dev/null 2>&1 to suppress both streams since dsymutil's
diagnostic output is not needed (the .dwarf file is the actual output).
This fix applies regardless of whether local or NuGet package NativeAOT
targets are used, since DsymUtilOptions is set in eng/toolAot.targets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the Apple platform settings (DsymUtilOptions, NativeSymbolExt) out of
the AotOrSingleFile condition gate into a UseNativeAotForComponents-only
PropertyGroup. This ensures projects like XUnitLogChecker that set
PublishAot directly (without AotOrSingleFile) also get the dsymutil stdout
suppression needed to avoid non-fatal PCM error messages breaking the build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 18, 2026 12:52
@kotlarmilos kotlarmilos marked this pull request as draft March 18, 2026 12:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


You can also share your feedback on Copilot code review. Take the survey.

- Revert -gline-tables-only from src/native/libs/CMakeLists.txt
- Revert -gnone back to -gline-tables-only for Swift compilation
- Revert CLRTest.CrossGen.targets stripping change
- Remove >/dev/null 2>&1 from DsymUtilOptions (redundant with IgnoreStandardErrorWarningFormat)
- Consolidate PropertyGroups in eng/toolAot.targets

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 20, 2026 09:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

dsymutil outputs non-fatal PCM module cache errors to stdout (not stderr).
IgnoreStandardErrorWarningFormat alone is insufficient to prevent MSBuild
from treating these as build errors. Redirect dsymutil output to suppress
the non-fatal PCM warnings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 23, 2026 13:41
@kotlarmilos kotlarmilos force-pushed the bugfix/enable-strip-symbols branch from b6f2be8 to 431d196 Compare March 23, 2026 13:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

@kotlarmilos
Copy link
Copy Markdown
Member Author

@steveisok @jkoritzinsky Please take a look again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove StripSymbols workaround for macOS NativeAOT publish once Swift module debug fix is available

4 participants