Skip to content

Commit

Permalink
ensure _Unwind_Backtrace to actually be available
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiud committed Dec 21, 2021
1 parent 9dc1107 commit 50d7e3f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ if (Unwind_FOUND)
set (HAVE_LIB_UNWIND 1)
else (Unwind_FOUND)
check_include_file_cxx (unwind.h HAVE_UNWIND_H)
# Check whether linking actually succeeds. ARM toolchains of LLVM unwind
# implementation do not necessarily provide the _Unwind_Backtrace function
# which causes the previous check to succeed but the linking to fail.
check_cxx_symbol_exists (_Unwind_Backtrace unwind.h HAVE__UNWIND_BACKTRACE)
endif (Unwind_FOUND)

check_include_file_cxx (dlfcn.h HAVE_DLFCN_H)
Expand Down
2 changes: 1 addition & 1 deletion bazel/glog.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
"src/stacktrace_generic-inl.h",
"src/stacktrace_libunwind-inl.h",
"src/stacktrace_powerpc-inl.h",
"src/stacktrace_unwind-inl.h",
"src/stacktrace_windows-inl.h",
"src/stacktrace_x86-inl.h",
"src/stacktrace_x86_64-inl.h",
"src/symbolize.cc",
"src/symbolize.h",
"src/utilities.cc",
Expand Down
3 changes: 3 additions & 0 deletions src/config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
/* Define if you have the <unwind.h> header file. */
#cmakedefine HAVE_UNWIND_H

/* Define if you linking to _Unwind_Backtrace is possible. */
#cmakedefine HAVE__UNWIND_BACKTRACE

/* define if the compiler supports using expression for operator */
#cmakedefine HAVE_USING_OPERATOR

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@

#if defined(HAVE_LIB_UNWIND)
# define STACKTRACE_H "stacktrace_libunwind-inl.h"
#elif defined(HAVE_UNWIND_H)
# define STACKTRACE_H "stacktrace_x86_64-inl.h"
#elif defined(HAVE__UNWIND_BACKTRACE)
# define STACKTRACE_H "stacktrace_unwind-inl.h"
#elif !defined(NO_FRAME_POINTER)
# if defined(__i386__) && __GNUC__ >= 2
# define STACKTRACE_H "stacktrace_x86-inl.h"
Expand Down

0 comments on commit 50d7e3f

Please sign in to comment.