-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make CoreCLR/NativeAOT assembly compile with .subsections_via_symbols on Apple platforms #92520
Conversation
… on Apple platforms
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsThe new Xcode 15 linker mishandles object files without the MH_SUBSECTIONS_VIA_SYMBOLS flag (
|
|
||
NotInHeap: | ||
b C_FUNC(RhpAssignRefArm64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional jump to non-local labels are not allowed in subsections-via-symbols mode. I updated 3-4 places to use non-conditional branches instead, it's mostly in the "rare" code paths.
Most of the diff is just decorating local labels with LOCAL_LABEL
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
/backport to release/8.0 |
Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/6286618371 |
We depend on assembly code to stay together here: runtime/src/coreclr/vm/amd64/JitHelpers_Fast.asm Lines 54 to 56 in 5dfd805
Can |
In theory it probably can. I'll check what the linker happens to do in practice. I don't think it does reordering, and we don't use "dead strip" or "identical code folding" options that could make this a real problem. (good catch!) |
Meanwhile, I checked that some other platforms (eg. arm32) split of this code into |
Checked output on arm64 so far, both in the default configuration and with added From the theoretical point of view, I think the linker is allowed to do some reordering. The comments in the old linker specifically mention "Atoms in the same section from the same .o file should be contiguous and sequenced in the same order they were in the .o file," but it's not obvious how hard the guarantee is and whether it applies only to the initial order or whether it can be affected by some subsequent optimization. The only two reordering optimizations that I am aware of are a) reordering initialiser/terminator functions to the start/end of code section, and b) reordering DATA section to group together data modified by the That leaves us with several options:
Interestingly, |
One more thing, |
I do not see a good reason for it. I think it should be outside the patched section in both cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Related to #92297 #92491
The new Xcode 15 linker mishandles object files without the MH_SUBSECTIONS_VIA_SYMBOLS flag (
.subsections_via_symbols
assembly code). It ends up treating the whole object file as one function and produces unwind info only for the first function in the file.