[PATCH] D100132: [libunwind][AIX] Initial patch of the unwinder on AIX

Xing Xue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 8 11:48:24 PDT 2021


xingxue created this revision.
xingxue added reviewers: ldionne, rprichard, jasonliu, hubert.reinterpretcast, cebowleratibm, libunwind.
xingxue added a project: LLVM.
Herald added subscribers: libcxx-commits, steven.zhang, mstorsjo, mgorny.
Herald added a project: libunwind.
Herald added 1 blocking reviewer(s): libunwind.
xingxue requested review of this revision.
Herald added a subscriber: llvm-commits.

This is the initial patch of the unwinder for `IBM` `AIX`.

- `AIX` does not support the `eh_frame` section. Instead, the `traceback table` located at the end 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.

- This patch supports 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., `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 `LSDA`s, `__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 directly assigned 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 with macros to accommodate differences in the representation of things such as registers of the `AIX` assembly language. The restoration of vector registers does not check `VRSAVE` because in the `AIX` ABI, `VRSAVE` is not used.

- Changes in `libcxxabi` for the `AIX` `EH` will be in a separate patch.

- No issues were found running tests of the `libunwind` and `libcxxabi` test suites, except some test cases of `libunwind` needs to be excluded for `AIX` and there are 7 `libcxxabi` test cases failing at the compile time. The `LIT` test will be addressed once the packaging of runtime libraries and the compiler for `AIX` is finalized.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100132

Files:
  libunwind/include/__libunwind_config.h
  libunwind/include/libunwind.h
  libunwind/src/AddressSpace.hpp
  libunwind/src/CMakeLists.txt
  libunwind/src/Registers.hpp
  libunwind/src/UnwindCursor.hpp
  libunwind/src/UnwindLevel1-gcc-ext.c
  libunwind/src/UnwindLevel1.c
  libunwind/src/UnwindRegistersRestore.S
  libunwind/src/UnwindRegistersSave.S
  libunwind/src/Unwind_AIXExtras.cpp
  libunwind/src/assembly.h
  libunwind/src/config.h
  libunwind/src/libunwind.cpp
  libunwind/src/libunwind_ext.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100132.336164.patch
Type: text/x-patch
Size: 56032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210408/fcb049a1/attachment.bin>


More information about the llvm-commits mailing list