[libcxx-commits] [PATCH] D100504: [libc++abi][AIX] initial patch for EH on AIX

Xing Xue via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 14 12:52:12 PDT 2021


xingxue created this revision.
xingxue added reviewers: MaskRay, phosek, mstorsjo, sfertile, jasonliu, hubert.reinterpretcast, cebowleratibm, libc++abi.
xingxue added a project: LLVM.
xingxue requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++abi.

This is the initial patch of the personality and related routines for `EH` on `IBM` `AIX`.

- 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 `XL` compiler, i.e., `xlclang++`. The `DWARF` based `range table` is used by `clang++` on `AIX`. 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`. `__xlcxx_personality_v1()` is actually an alias of `__gxx_personality_v0()`.  The reason for using a different name is to create a dependence of `clang++` compiled applications on `libc++abi` instead of `GCC`'s runtime. 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.

- For functions invoked by `scan_eh_tab()` to scan the `range table`, a new parameter `base` is added to pass the base for calculating relative addresses and the case for `DW_EH_PE_datarel` encoding is enabled. For platforms where `base` is not used, `base` defaults to 0. After setting registers for jumping to the user code in `xlcxx_personality_v1()`/`gxx_personality_v0()`, `base` is cached in `exception_header` member `catchTemp` for use in `__cxa_call_unexpected` if `ttypeIndex` is less than 0 (exception spec).

- Function `scan_state_tab()` is added to scan the `state table`. It returns `scan_results` like `scan_eh_tab()` does.

- A couple of functions invoked by `xlclang++` generated code for `EH` are also added, e.g., `__xlc_catch_matchv2()` which checks whether the thrown object matches the catch handler's exception declaration.

- Debugging macros `_LIBCXXABI_TRACE_STATETAB`, `_LIBCXXABI_TRACE_STATETAB0`, and `_LIBCXXABI_TRACING_STATETAB` are added to dump `state table` scanning traces if environment variable `LIBCXXABI_PRINT_STATTAB` is set.

- Changes in `libunwind` for `AIX` `EH` is in a separate patch, https://reviews.llvm.org/D100132.

- No issues were found when running tests of the `libunwind` and `libcxxabi` test suites, except some test cases of `libunwind` need to be excluded for `AIX` and there are 7 `libcxxabi` test cases fail 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/D100504

Files:
  libcxxabi/src/cxa_personality.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100504.337527.patch
Type: text/x-patch
Size: 45704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210414/02569ca3/attachment-0001.bin>


More information about the libcxx-commits mailing list