[libunwind] [libunwind][AIX] Fix up TOC register if unw_getcontext is called from a different module (PR #66549)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 15 14:28:12 PDT 2023
================
@@ -305,9 +305,22 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
mflr 0
std 0, PPC64_OFFS_SRR0(3) // store lr as ssr0
PPC64_STR(1)
+ PPC64_STR(4) // Save r4 first since it will be used for fixing r2.
+#if defined(_AIX)
+ // The TOC register (r2) was changed by the glue code if unw_getcontext
+ // is called from a different module. Save the original TOC register
+ // in the context if this is the case.
+ mflr 4
----------------
stephenpeckham wrote:
Not a bit deal, but LR is already in r0. Do you need mflr twice? You could use mr r4,r0.
https://github.com/llvm/llvm-project/pull/66549
More information about the cfe-commits
mailing list