[all-commits] [llvm/llvm-project] b46c89: [XRay][compiler-rt][x86_64] Fix CFI directives in ...

Elia Geretto via All-commits all-commits at lists.llvm.org
Sat Mar 6 10:38:44 PST 2021


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

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

  Log Message:
  -----------
  [XRay][compiler-rt][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