Skip to content

Conversation

@am11
Copy link
Member

@am11 am11 commented Mar 6, 2023

In this case, two objects (.o) with same name are linked in a static library (gc/unix/cgroup.cpp and nativeaot/Runtime/unix/cgroup.cpp) and the linkage order of objects is nondeterministic. When such a static library is linked into the final object on macOS (executable or library), and we run dsymutil on it to strip its symbols, dsymutil does not look past the first object by name and intermittently warns about missing symbols when the linkage order was reversed. That warning turns into error in NativeAOT publishing process.

Simplest fix is to rename the source file to disambiguate the output object filename.

Also refactor the code a bit: instead of using header for InitializeCpuCGroup and extern for GetCpuLimit, use header for both APIs.

Revert #82881
Fix #80934

@ghost ghost added area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member labels Mar 6, 2023
@ghost
Copy link

ghost commented Mar 6, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details
  • Instead of using header for InitializeCpuCGroup and extern for GetCpuLimit, use header for both APIs.
  • Remove CGroup class with static methods and replace with flat functions defined in order.

This prevents dsymutil on macOS intermittent failures to find these symbols off of static libs.

Revert #82881
Fix #80934

Author: am11
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@am11 am11 marked this pull request as ready for review March 6, 2023 20:12
@am11 am11 requested a review from MichalStrehovsky as a code owner March 6, 2023 20:12
@am11 am11 requested a review from jkotas March 6, 2023 20:12
@am11 am11 force-pushed the feature/build/symbol-stripping branch 2 times, most recently from 0003f4b to 16e6e08 Compare March 7, 2023 00:06
@am11 am11 force-pushed the feature/build/symbol-stripping branch from 16e6e08 to 1dd525f Compare March 7, 2023 10:01
@am11 am11 changed the title Refactor cgroupcpu and re-strip CG2 symbols Rename cgroup.cpp to cgroupcpu.cpp Mar 7, 2023
@am11
Copy link
Member Author

am11 commented Mar 7, 2023

@jkotas, I ran build in 50x loop on M1 machine and found no failure (it fails about every third build without the second commit). Filename cgroupcpu.cpp is chosen based on its existing header cgroupcpu.h.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thank you!

@jkotas jkotas merged commit 0e1ede5 into dotnet:main Mar 8, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NativeAOT/osx-arm64] Warnings publishing classlib with StripSymbols=true

2 participants