[all-commits] [llvm/llvm-project] 2919ad: [Hexagon] Add ShadowCallStack support (#200508)

Brian Cain via All-commits all-commits at lists.llvm.org
Thu Jun 25 19:38:37 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2919ad75affbfae061415f451a4ba8b7c76d44a3
      https://github.com/llvm/llvm-project/commit/2919ad75affbfae061415f451a4ba8b7c76d44a3
  Author: Brian Cain <brian.cain at oss.qualcomm.com>
  Date:   2026-06-26 (Fri, 26 Jun 2026)

  Changed paths:
    M clang/lib/Driver/SanitizerArgs.cpp
    M clang/lib/Driver/ToolChains/Linux.cpp
    A clang/test/Driver/fsanitize-shadow-call-stack-hexagon.c
    M compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
    M compiler-rt/test/shadowcallstack/libc_support.h
    M compiler-rt/test/shadowcallstack/lit.cfg.py
    M compiler-rt/test/shadowcallstack/minimal_runtime.h
    M llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
    A llvm/test/CodeGen/Hexagon/shadow-call-stack.ll

  Log Message:
  -----------
  [Hexagon] Add ShadowCallStack support (#200508)

Implement the software ShadowCallStack for Hexagon.

On Hexagon, r19 is used as the shadow stack pointer (reserved via
-ffixed-r19). On function entry the LR (r31) is saved to the shadow
stack and the pointer is advanced; on exit the LR is restored from the
shadow stack before returning.

Prologue sequence:

    r19 = add(r19, #4)
    memw(r19+#-4) = r31

Epilogue sequence (between deallocframe/jumpr r31):

    r31 = memw(r19+#-4)
    r19 = add(r19, #-4)

SCS is only emitted when hasFP() is true: the function uses allocframe.
Leaf functions that never touch the stack do not need protection.

When SCS is active the combined L4_return (deallocframe+jump) is not
used; instead L2_deallocframe and PS_jmpret are kept separate so the
shadow-stack restore can be inserted between them.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list