diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cb747724..766ef9892 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/bazel/glog.bzl b/bazel/glog.bzl index 1392bfb96..43a2637fc 100644 --- a/bazel/glog.bzl +++ b/bazel/glog.bzl @@ -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", diff --git a/src/config.h.cmake.in b/src/config.h.cmake.in index ca278ad4f..b225b7ecd 100644 --- a/src/config.h.cmake.in +++ b/src/config.h.cmake.in @@ -118,6 +118,9 @@ /* Define if you have the 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 diff --git a/src/stacktrace_x86_64-inl.h b/src/stacktrace_unwind-inl.h similarity index 100% rename from src/stacktrace_x86_64-inl.h rename to src/stacktrace_unwind-inl.h diff --git a/src/utilities.h b/src/utilities.h index bd818dc5d..1f55eff43 100644 --- a/src/utilities.h +++ b/src/utilities.h @@ -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"