[all-commits] [llvm/llvm-project] cc8edb: [libunwind][AIX] Save/restore errno before/after s...

xingxue-ibm via All-commits all-commits at lists.llvm.org
Mon Aug 8 14:22:45 PDT 2022

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

  Changed paths:
    M libunwind/src/UnwindCursor.hpp

  Log Message:
  [libunwind][AIX] Save/restore errno before/after system calls dlopen/dlsym/dlclose

libunwind on AIX calls dlopen()/dlsym()/dlclose() to dynamically load libc++abi and get the personality for state table EH when it is running against the legacy xlcang++ compiler genereated applications. dlopen() sets errno to 0 when it is successful, which clobbers the value in errno from the user code. This seems to be an AIX bug that it should not set errno to 0 according to POSIX. We will open a bug report to AIX but in the mean time there won't be time line when AIX will have a fix and even AIX does fix it, it won't help earlier AIX releases in the field. This patch saves and restores errno before and after these calls so that user code can work as expected.

Reviewed by: compnerd, libunwind

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

More information about the All-commits mailing list