abseil / abseil/abseil-cpp

[Bug]: absl_stacktrace calls backtrace() which uses libgcc_s unwinding which is ABI incompatible with LLVM libunwind

未關閉
#1,376 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C++
星號
18.1k
分支
3.2k
平均合併
20 小時 36 分鐘
30 天內合併 PR
1

描述

### 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_

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。