abseil / abseil/abseil-cpp

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

Abierto
#1,376 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
18.1k
Forks
3.2k
Merge medio
20 h 36 min
PR fusionados (30 d)
1

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.