[all-commits] [llvm/llvm-project] 2366c6: [libunwind][AIX] Implement _Unwind_FindEnclosingFu...

xingxue-ibm via All-commits all-commits at lists.llvm.org
Fri Aug 12 15:09:30 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2366c6adfc95e1aca9afbbbf5251a61552865b55
      https://github.com/llvm/llvm-project/commit/2366c6adfc95e1aca9afbbbf5251a61552865b55
  Author: Xing Xue <xingxue at outlook.com>
  Date:   2022-08-12 (Fri, 12 Aug 2022)

  Changed paths:
    M libunwind/src/UnwindLevel1-gcc-ext.c
    M libunwind/src/Unwind_AIXExtras.cpp

  Log Message:
  -----------
  [libunwind][AIX] Implement _Unwind_FindEnclosingFunction() using traceback table on AIX

Summary:
The implementation of  _Unwind_FindEnclosingFunction(void *ip) takes the context of itself and then uses the context to get the info of the function enclosing ip. This approach does not work for AIX because on AIX, the TOC base in GPR2 is used as the base for calculating relative addresses. Since  _Unwind_FindEnclosingFunction() may be in a different shared lib than the function containing ip, their TOC bases can be different. Therefore, using the value of GPR2 in the context from  _Unwind_FindEnclosingFunction() as the base results in incorrect addresses. On the other hand, the start address of a function is available in the traceback table following the instructions of each function on AIX. To get to the traceback table, search a word of 0 starting from ip and the traceback table is located after the word 0. This patch implements _Unwind_FindEnclosingFunction() for AIX by obtaining the function start address from its traceback table.

Reviewed by: compnerd, MaskRay, libunwind

Differential Revision: https://reviews.llvm.org/D131709




More information about the All-commits mailing list