Files
Brian Cain 2919ad75af [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.
2026-06-26 02:38:14 +00:00
..
…