mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 12:26:07 +00:00

`__xlcxx_personality_v0` is the personality routine in `libc++abi` for the EH of applications generated by the legacy IBM C++ compiler. Since the EH info generated by the legacy compiler does not provide the location of the personality routine, this routine is hard-coded as the handler for legacy EH in the unwinder. The symbol is resolved dynamically using `dlopen()` to avoid a hard dependency of `libunwind` on `libc++abi` for cases such as non-C++ applications. The weak declaration of `__xlcxx_personality_v0` was originally intended to bypass `dlopen()` if the C++ application generated by the legacy compiler is statically linked with the new LLVM C++ compiler. Unfortunately, this causes problems with runtime linking for Clang-compiled code using the unwinder that does not link with `libc++abi`. On the other hand, the C++ runtime libraries shipped for AIX are actually stripped and statically linking is not supported. So, we can fix the problem by removing the `__xlcxx_personality_v0` weak declaration. Besides, `dlopen()` would work as long as the libc++abi shared library is available.
21 lines
693 B
C++
21 lines
693 B
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Test that libunwind loads successfully independently of libc++abi with
|
|
// runtime linking on AIX.
|
|
|
|
// REQUIRES: target={{.+}}-aix{{.*}}
|
|
// ADDITIONAL_COMPILE_FLAGS: -Wl,-brtl
|
|
|
|
#include <unwind.h>
|
|
extern "C" int printf(const char *, ...);
|
|
int main(void) {
|
|
void *fp = (void *)&_Unwind_Backtrace;
|
|
printf("%p\n", fp);
|
|
}
|