Uh oh!
There was an error while loading. Please reload this page.
Make CoreCLR/NativeAOT assembly compile with .subsections_via_symbols on Apple platforms - #92520
Conversation
… on Apple platforms
ghost
commented
Sep 23, 2023
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsThe new Xcode 15 linker mishandles object files without the MH_SUBSECTIONS_VIA_SYMBOLS flag (
|
| bhsLOCAL_LABEL(NotInHeap) | ||
| NotInHeap: | ||
| b C_FUNC(RhpAssignRefArm64) |
There was a problem hiding this comment.
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.
jkotas
commented
Sep 23, 2023
/backport to release/8.0 |
Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/6286618371 |
jkotas
commented
Sep 24, 2023
We depend on assembly code to stay together here: runtime/src/coreclr/vm/amd64/JitHelpers_Fast.asm Lines 54 to 56 in 5dfd805 Can |
filipnavara
commented
Sep 24, 2023
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, |
filipnavara
commented
Sep 24, 2023
One more thing, |
jkotas
commented
Sep 26, 2023
I do not see a good reason for it. I think it should be outside the patched section in both cases. |
Related to #92297#92491
The new Xcode 15 linker mishandles object files without the MH_SUBSECTIONS_VIA_SYMBOLS flag (
.subsections_via_symbolsassembly code). It ends up treating the whole object file as one function and produces unwind info only for the first function in the file.