Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Commit 50d7e3f

Browse files
committed
ensure _Unwind_Backtrace to actually be available
1 parent 9dc1107 commit 50d7e3f

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ if (Unwind_FOUND)
9494
set (HAVE_LIB_UNWIND 1)
9595
else (Unwind_FOUND)
9696
check_include_file_cxx (unwind.h HAVE_UNWIND_H)
97+
# Check whether linking actually succeeds. ARM toolchains of LLVM unwind
98+
# implementation do not necessarily provide the _Unwind_Backtrace function
99+
# which causes the previous check to succeed but the linking to fail.
100+
check_cxx_symbol_exists (_Unwind_Backtrace unwind.h HAVE__UNWIND_BACKTRACE)
97101
endif (Unwind_FOUND)
98102

99103
check_include_file_cxx (dlfcn.h HAVE_DLFCN_H)

bazel/glog.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
128128
"src/stacktrace_generic-inl.h",
129129
"src/stacktrace_libunwind-inl.h",
130130
"src/stacktrace_powerpc-inl.h",
131+
"src/stacktrace_unwind-inl.h",
131132
"src/stacktrace_windows-inl.h",
132133
"src/stacktrace_x86-inl.h",
133-
"src/stacktrace_x86_64-inl.h",
134134
"src/symbolize.cc",
135135
"src/symbolize.h",
136136
"src/utilities.cc",

src/config.h.cmake.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@
118118
/* Define if you have the <unwind.h> header file. */
119119
#cmakedefine HAVE_UNWIND_H
120120

121+
/* Define if you linking to _Unwind_Backtrace is possible. */
122+
#cmakedefine HAVE__UNWIND_BACKTRACE
123+
121124
/* define if the compiler supports using expression for operator */
122125
#cmakedefine HAVE_USING_OPERATOR
123126

src/utilities.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888

8989
#if defined(HAVE_LIB_UNWIND)
9090
# define STACKTRACE_H "stacktrace_libunwind-inl.h"
91-
#elif defined(HAVE_UNWIND_H)
92-
# define STACKTRACE_H "stacktrace_x86_64-inl.h"
91+
#elif defined(HAVE__UNWIND_BACKTRACE)
92+
# define STACKTRACE_H "stacktrace_unwind-inl.h"
9393
#elif !defined(NO_FRAME_POINTER)
9494
# if defined(__i386__) && __GNUC__ >= 2
9595
# define STACKTRACE_H "stacktrace_x86-inl.h"

0 commit comments

Comments
 (0)