Skip to content

Re-enable symbol stripping for Apple platforms - #124266

Merged
kotlarmilos merged 19 commits into
dotnet:mainfrom
kotlarmilos:bugfix/enable-strip-symbols
Apr 8, 2026
Merged

Re-enable symbol stripping for Apple platforms#124266
kotlarmilos merged 19 commits into
dotnet:mainfrom
kotlarmilos:bugfix/enable-strip-symbols

Conversation

@kotlarmilos

@kotlarmiloskotlarmilos commented Feb 11, 2026

Copy link
Copy Markdown
Member

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

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

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

CopilotAI review requested due to automatic review settings February 27, 2026 09:21

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment threadsrc/tests/Common/CLRTest.CrossGen.targets Outdated
@kotlarmilos

Copy link
Copy Markdown
MemberAuthor

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

CopilotAI review requested due to automatic review settings March 4, 2026 13:54

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment threadsrc/tests/Common/CLRTest.CrossGen.targets Outdated
CopilotAI review requested due to automatic review settings March 20, 2026 09:15

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment threadeng/toolAot.targets
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>
CopilotAI review requested due to automatic review settings March 23, 2026 13:41
@kotlarmilos
kotlarmilosforce-pushed the bugfix/enable-strip-symbols branch from b6f2be8 to 431d196CompareMarch 23, 2026 13:41

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment threadeng/toolAot.targets
@kotlarmilos

Copy link
Copy Markdown
MemberAuthor

@steveisok@jkoritzinsky Please take a look again

@kotlarmilos

Copy link
Copy Markdown
MemberAuthor

/ba-g job ran longer than the maximum time / job was abandoned due to an infrastructure failure

@kotlarmilos
kotlarmilos merged commit c47c417 into dotnet:mainApr 8, 2026
183 of 191 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators May 9, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

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

@kotlarmilos@jkoritzinsky@MichalStrehovsky