[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 17 16:55:05 PDT 2025


================
@@ -93,6 +98,13 @@ class _LIBUNWIND_HIDDEN Registers_x86 {
   uint32_t  getEDI() const         { return _registers.__edi; }
   void      setEDI(uint32_t value) { _registers.__edi = value; }
 
+  typedef uint32_t reg_t;
+  typedef uint32_t link_reg_t;
+  void loadAndAuthenticateLinkRegister(reg_t srcLinkRegister,
----------------
kovdan01 wrote:

Since `loadAndAuthenticateLinkRegister` is used in UnwindCursor.hpp as a member function of a `registers` object (having template registers class type), we should probably consider one of the following options.

1. Define `loadAndAuthenticateLinkRegister` for all the register classes. As far as I can see now, your patch contains definitions for x86, x86_64, ppc, arm64 and arm, but we also have mips, risc-v, ...
2. Only limit this function to arm64 and do not expose that to register classes for other architectures. In this case, you'll probably need to insert checks like `__has_feature(...)` in UnwindCursor.hpp and add special logic in these cases.
 
I personally prefer the 2nd option. It's not very nice, but IMHO this is better than adding a placeholder function for all the architectures.

https://github.com/llvm/llvm-project/pull/143230


More information about the llvm-commits mailing list