[Bug]: absl_stacktrace calls backtrace() which uses libgcc_s unwinding which is ABI incompatible with LLVM libunwind
- Dominant language
- C++
- Stars
- 18.1k
- Forks
- 3.2k
- Avg merge
- 20h 36m
- Merged PRs (30d)
- 1
Description
### Describe the issue
The absl_stacktrace library performs a call to libc's backtrace(...) function during dynamic initialization: https://github.com/abseil/abseil-cpp/blob/lts_2023_01_25/absl/debugging/internal/stacktrace_generic-inl.inc#L53
This method will in turn dynamically load libgcc_s.so at runtime (https://elixir.bootlin.com/glibc/glibc-2.36/source/debug/backtrace.c#L69 and https://elixir.bootlin.com/glibc/glibc-2.36/source/misc/unwind-link.c#L50) and use the unwinding API from that library to walk the stack.
This poses a problem (i.e. segmentation fault) for applications that were built with LLVM libunwind because the GCC and LLVM unwinders are not ABI compatible.
I checked the absl CMake build system and was unable to find a toggle that would allow me to opt out of stacktrace support or to have it use stacktrace_unimplemented-inl.inc instead of stacktrace_generic-inl.inc with ABSL_STACKTRACE_INL_HEADER not being allowed to be set from the outside.
### Steps to reproduce the problem
Build application, that uses absl, with LLVM libunwind (e.g. --rtlib=compiler-rt -unwindlib=libunwind).
The program will segfault during the call to backtrace() when starting up and before reaching main().
### What version of Abseil are you using?
#define ABSL_LTS_RELEASE_VERSION 20211102
#define ABSL_LTS_RELEASE_PATCH_LEVEL 0
### What operating system and version are you using?
Linux on arm-linux-gnueabihf
glibc 2.23
### What compiler and version are you using?
Clang 13 compiler backed by buildroot GCC 4.9.3 sysroot
libc++13, libc++abi-13, and libunwind 13
### What build system are you using?
cmake version 3.25.1
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.