[all-commits] [llvm/llvm-project] 9ee61c: [XRay][x86_64] Fix CFI directives in assembly tram...

Elia Geretto via All-commits all-commits at lists.llvm.org
Wed Mar 3 10:01:47 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9ee61cf3f67b9fdcee7c2dd650321264376bc0f2
      https://github.com/llvm/llvm-project/commit/9ee61cf3f67b9fdcee7c2dd650321264376bc0f2
  Author: Elia Geretto <elia.f.geretto at gmail.com>
  Date:   2021-03-03 (Wed, 03 Mar 2021)

  Changed paths:
    M compiler-rt/lib/xray/xray_trampoline_x86_64.S

  Log Message:
  -----------
  [XRay][x86_64] Fix CFI directives in assembly trampolines

This patch modifies the x86_64 XRay trampolines to fix the CFI information
generated by the assembler. One of the main issues in correcting the CFI
directives is the `ALIGNED_CALL_RAX` macro, which makes the CFA dependent on
the alignment of the stack. However, this macro is not really necessary because
some additional assumptions can be made on the alignment of the stack when the
trampolines are called. The code has been written as if the stack is guaranteed
to be 8-bytes aligned; however, it is instead guaranteed to be misaligned by 8
bytes with respect to a 16-bytes alignment. For this reason, always moving the
stack pointer by 8 bytes is sufficient to restore the appropriate alignment.

Trampolines that are called from within a function as a result of the builtins
`__xray_typedevent` and `__xray_customevent` are necessarely called with the
stack properly aligned so, in this case too, `ALIGNED_CALL_RAX` can be
eliminated.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=49060

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D96785




More information about the All-commits mailing list