ensure _Unwind_Backtrace to actually be available

This commit is contained in:
Sergiu Deitsch 2021-12-21 10:47:24 +01:00 committed by Sergiu Deitsch
parent 087ad5bf32
commit 4ffa98388f
5 changed files with 10 additions and 3 deletions

View File

@ -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)

View File

@ -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",

View File

@ -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

View File

@ -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"