Commit 4fa2dc3
committed
fix(callgrind): skip arm64 _dl_tlsdesc_* resolvers like PLT stubs
Every TLSDESC __thread access blr's into the dynamic linker's resolver,
which rets straight back into the middle of the accessing function. When
the access is made from an obj-skipped object (CPython under
pytest-codspeed), the skipped->nonskipped splice pushed the resolver
frame with ret_addr 0; its mid-function return could never match, the
RET-w/o-CALL promotion re-entered the skipped object with nonskipped
pointing at the resolver, and skipped cost plus call edges piled up
under _dl_tlsdesc_return -- pulling nearly whole Python flamegraphs
under that node, plus inverted return-direction edges.
Mark _dl_tlsdesc_* skipped (gated on --skip-plt, arm64 only), the same
transparent-trampoline class as _dl_runtime_resolve; pop_on_jump cannot
apply since these exit via a plain ret to a non-entry address. Skip
pushes are never spliced and record the architectural X30, so the
return pops cleanly and cost keeps flowing to the real non-skipped
caller.
Regression: callgrind-utils/tests/arm64_tls_access.rs (plain +
--obj-skip runs of the shared-lib TLS fixture); both tests fail on the
unfixed tool.1 parent 1d23d5f commit 4fa2dc3
1 file changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
714 | 750 | | |
715 | 751 | | |
716 | 752 | | |
| |||
0 commit comments