[all-commits] [llvm/llvm-project] a85da6: [libunwind][AIX] implementation of the unwinder fo...

xingxue-ibm via All-commits all-commits at lists.llvm.org
Wed Apr 13 08:04:58 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a85da649b9ac67afffec6bff9487e6405e1f9cba
  Author: Xing Xue <xingxue at outlook.com>
  Date:   2022-04-13 (Wed, 13 Apr 2022)

  Changed paths:
    M libunwind/include/libunwind.h
    M libunwind/include/unwind.h
    M libunwind/src/AddressSpace.hpp
    M libunwind/src/CMakeLists.txt
    M libunwind/src/Registers.hpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindLevel1-gcc-ext.c
    M libunwind/src/UnwindLevel1.c
    M libunwind/src/UnwindRegistersRestore.S
    M libunwind/src/UnwindRegistersSave.S
    A libunwind/src/Unwind_AIXExtras.cpp
    M libunwind/src/assembly.h
    M libunwind/src/config.h
    M libunwind/src/libunwind.cpp
    M libunwind/src/libunwind_ext.h

  Log Message:
  [libunwind][AIX] implementation of the unwinder for AIX

This patch contains the implementation of the unwinder for IBM AIX.

AIX does not support the eh_frame section. Instead, the traceback table located at the end of each function provides the information for stack unwinding and EH. In this patch macro _LIBUNWIND_SUPPORT_TBTAB_UNWIND is used to guard code for AIX traceback table based unwinding. Function getInfoFromTBTable() and stepWithTBTable() are added to get the EH information from the traceback table and to step up the stack respectively.

There are two kinds of LSDA information for EH on AIX, the state table and the range table. The state table is used by the previous version of the IBM XL compiler, i.e., xlC and xlclang++. The DWARF based range table is used by AIX clang++. The traceback table has flags to differentiate these cases. For the range table, relative addresses are calculated using a base of DW_EH_PE_datarel, which is the TOC base of the module where the function of the current frame belongs.

Two personality routines are employed to handle these two different LSDAs, __xlcxx_personality_v0() for the state table and __xlcxx_personality_v1() for the range table. Since the traceback table does not have the information of the personality for the state table approach, its personality __xlcxx_personality_v0() is dynamically resolved as the handler for the state table. For the range table, the locations of the LSDA and its associated personality routine are found in the traceback table.

Assembly code for 32- and 64-bit PowerPC in UnwindRegistersRestore.S and UnwindRegistersSave.S are modified so that it can be consumed by the GNU flavor assembler and the AIX assembler. The restoration of vector registers does not check VRSAVE on AIX because VRSAVE is not used in the AIX ABI.

Reviewed by: MaskRay, compnerd, cebowleratibm, sfertile, libunwind

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

More information about the All-commits mailing list