[PATCH] D27143: Reenable crash backtraces on FreeBSD

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 25 06:41:58 PDT 2017


arichardson updated this revision to Diff 93040.
arichardson retitled this revision from "Reenable backtraces on FreeBSD" to "Reenable crash backtraces on FreeBSD".
arichardson edited the summary of this revision.
arichardson added a reviewer: dim.

https://reviews.llvm.org/D27143

Files:
  cmake/config-ix.cmake
  lib/Support/CMakeLists.txt
  lib/Support/Unix/Signals.inc


Index: lib/Support/Unix/Signals.inc
===================================================================
--- lib/Support/Unix/Signals.inc
+++ lib/Support/Unix/Signals.inc
@@ -46,8 +46,8 @@
 #ifdef HAVE__UNWIND_BACKTRACE
 // FIXME: We should be able to use <unwind.h> for any target that has an
 // _Unwind_Backtrace function, but on FreeBSD the configure test passes
-// despite the function not existing, and on Android, <unwind.h> conflicts
-// with <link.h>.
+// despite the function not existing unless _GNU_SOURCE is defined, and
+// on Android, <unwind.h> conflicts with <link.h>.
 #ifdef __GLIBC__
 #include <unwind.h>
 #else
Index: lib/Support/CMakeLists.txt
===================================================================
--- lib/Support/CMakeLists.txt
+++ lib/Support/CMakeLists.txt
@@ -24,6 +24,9 @@
   if( UNIX AND NOT (BEOS OR HAIKU) )
     set(system_libs ${system_libs} m)
   endif()
+  if (HAVE_BACKTRACE AND CMAKE_SYSTEM MATCHES "FreeBSD")
+    set(system_libs ${system_libs} execinfo)
+  endif()
 endif( MSVC OR MINGW )
 
 add_llvm_library(LLVMSupport
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -165,6 +165,9 @@
 
 # function checks
 check_symbol_exists(arc4random "stdlib.h" HAVE_DECL_ARC4RANDOM)
+if(CMAKE_SYSTEM MATCHES "FreeBSD")
+  list(APPEND CMAKE_REQUIRED_LIBRARIES "execinfo")
+endif()
 check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE)
 check_symbol_exists(_Unwind_Backtrace "unwind.h" HAVE__UNWIND_BACKTRACE)
 check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27143.93040.patch
Type: text/x-patch
Size: 1619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170325/ea99982d/attachment.bin>


More information about the llvm-commits mailing list