Issue |
148595
|
Summary |
[BOLT] Frame pointers break instrumentation
|
Labels |
BOLT
|
Assignees |
|
Reporter |
peterwaller-arm
|
This issue is split from https://github.com/llvm/llvm-project/issues/147569, which is now thought to be an independent problem.
With frame pointers enabled in the bolt runtimes, bolt instrumentation causes the workload to crash due to stack corruption. A fix is available in https://github.com/llvm/llvm-project/pull/148009. Notably this happened in nixpkgs recently when they [turned on frame pointers across the whole package set](https://github.com/NixOS/nixpkgs/pull/399014).
The cause is thought to be the use of `-mno-omit-leaf-frame-pointer`, which causes GCC to emit a prolog/epilogue on some functions implemented in assembly even if they are marked `__attribute((naked))`, per https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77882.
https://github.com/llvm/llvm-project/blob/dbb79c30c9f3578b7afd9ea0ec33f82e70e472c7/bolt/runtime/instr.cpp#L1666
Example generated code:
```
0000000000000000 <__bolt_instr_indirect_call>:
0: a9bf7bfd stp x29, x30, [sp, #-16]!
4: 910003fd mov x29, sp
8: a9bf07e0 stp x0, x1, [sp, #-16]!
c: a9bf0fe2 stp x2, x3, [sp, #-16]!
10: a9bf17e4 stp x4, x5, [sp, #-16]!
14: a9bf1fe6 stp x6, x7, [sp, #-16]!
18: a9bf27e8 stp x8, x9, [sp, #-16]!
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs