Re-enable symbol stripping for Apple platforms#124266
Re-enable symbol stripping for Apple platforms#124266kotlarmilos wants to merge 17 commits intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
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=falseworkaround 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 |
|
The macOS jobs are still reporting missing module cache files (.pcm). |
There was a problem hiding this comment.
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.
The NativeAOT SDK targets invoke dsymutil during symbol stripping. Apple's pre-built Swift runtime static libraries contain -gmodules debug info with references to .pcm module cache files that don't exist on build machines. dsymutil outputs 'error:' for these missing files but exits 0 (non-fatal). MSBuild's Exec task parses the output and treats them as build errors. The tool AOT publish (ILCompiler, crossgen2, XUnitLogChecker) uses the SDK's NativeAOT targets, not the source-tree targets, so the IgnoreStandardError WarningFormat fix in Microsoft.NETCore.Native.targets doesn't apply here. Redirecting dsymutil stderr via DsymUtilOptions suppresses the non-fatal warnings while preserving exit code based error detection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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.
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>
There was a problem hiding this comment.
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>
| <PropertyGroup Condition="'$(AotOrSingleFile)' == 'true' and '$(UseNativeAotForComponents)' == 'true'"> | ||
| <PublishAot>true</PublishAot> | ||
| <PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'"> | ||
| <PublishAot Condition="'$(AotOrSingleFile)' == 'true'" >true</PublishAot> |
There was a problem hiding this comment.
There is an extra space before the closing angle bracket in the <PublishAot ...> element (... == 'true'" >true). This is inconsistent with the surrounding XML formatting and should be removed to keep the file tidy and avoid noisy diffs in future edits.
| <PublishAot Condition="'$(AotOrSingleFile)' == 'true'" >true</PublishAot> | |
| <PublishAot Condition="'$(AotOrSingleFile)' == 'true'">true</PublishAot> |
Description
This PR re-enables symbol stripping for Apple platforms that was disabled as a workaround in #123687.
Changes
Re-enable stripping in
ILCompiler_publish.csproj,crossgen2_publish.csproj,ilasm.csproj, andXUnitLogChecker.csprojby removing theStripSymbols=falseworkaround.Handle non-fatal dsymutil warnings by adding
IgnoreStandardErrorWarningFormat="true"to the dsymutil<Exec>tasks inMicrosoft.NETCore.Native.targets,Microsoft.NET.CrossGen.targets, andnative-library.targets. Apple's pre-built Swift runtime static libraries (swiftCore,swiftFoundation) contain DWARF debug info with-gmodulesreferences to.pcmmodule cache files that only existed on Apple's build machines.dsymutiloutputserror:messages for these missing files but exits with code 0 (non-fatal). Without this flag, MSBuild's<Exec>task parses the output forerror:patterns and incorrectly counts them as build errors. Non-zero exit codes (real failures) are still caught.Fix Apple platform detection in
eng/toolAot.targetsforNativeSymbolExtandDsymUtilOptions. The_IsApplePlatformproperty from the NativeAOT NuGet package is not available at this evaluation point, so usePortableOSinstead. Broadened the condition toUseNativeAotForComponents(fromAotOrSingleFile and UseNativeAotForComponents) to cover components like XUnitLogChecker that setPublishAotdirectly.Fixes #123687