aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-12-03 07:45:22 +0000
committerEric Christopher <echristo@apple.com>2010-12-03 07:45:22 +0000
commit481d402ab03e163e180d2650fae13704858f8d81 (patch)
tree4b7b2c21936998c1a4986da5fd6a491f3cb592c0
parent9b391c513e0051289c7013dd9917eb6176724920 (diff)
Apparently OS X 10.4 doesn't have __crashreporter_info__.
Try to fix building on the wayback machine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120801 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--autoconf/configure.ac10
-rwxr-xr-xconfigure75
-rw-r--r--include/llvm/Config/config.h.in3
-rw-r--r--lib/Support/PrettyStackTrace.cpp10
4 files changed, 89 insertions, 9 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index ee58d8e9e8..b8d4a30715 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -1321,9 +1321,17 @@ if test "$llvm_cv_enable_libffi" = "yes" ; then
AC_CHECK_HEADERS([ffi.h ffi/ffi.h])
fi
-dnl Try to find Darwin specific crash reporting library.
+dnl Try to find Darwin specific crash reporting libraries.
AC_CHECK_HEADERS([CrashReporterClient.h])
+dnl Try to find Darwin specific crash reporting global.
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[const char *__crashreporter_info__;]], [[]])],[darwin_crashreport = yes],[darwin_crashreport = no])
+AC_MSG_RESULT($darwin_crashreport)
+if test "x$darwin_crashreport = xyes"
+then
+ AC_DEFINE([HAVE_CRASHREPORTER_INFO],[1],
+ [Define if __crashreporter_info__ exists.])
+fi
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 7: Check for types and structures
diff --git a/configure b/configure
index ea8d1f20ac..88fe0fddaa 100755
--- a/configure
+++ b/configure
@@ -773,12 +773,12 @@ HAVE_PTHREAD
HUGE_VAL_SANITY
MMAP_FILE
LLVMCC_EMITIR_FLAG
-LLVMCC_DISABLEOPT_FLAGS
LLVMCC1
LLVMCC1PLUS
LLVMGCCDIR
LLVMGCC_LANGS
LLVMGCC_DRAGONEGG
+LLVMCC_DISABLEOPT_FLAGS
SHLIBEXT
SHLIBPATH_VAR
LLVM_PREFIX
@@ -11518,7 +11518,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 11525 "configure"
+#line 11521 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17419,6 +17419,75 @@ fi
done
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+const char *__crashreporter_info__;
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ darwin_crashreport = yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ darwin_crashreport = no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $darwin_crashreport" >&5
+echo "${ECHO_T}$darwin_crashreport" >&6; }
+if test "x$darwin_crashreport = xyes"
+then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_CRASHREPORTER_INFO 1
+_ACEOF
+
+fi
@@ -21839,12 +21908,12 @@ HAVE_PTHREAD!$HAVE_PTHREAD$ac_delim
HUGE_VAL_SANITY!$HUGE_VAL_SANITY$ac_delim
MMAP_FILE!$MMAP_FILE$ac_delim
LLVMCC_EMITIR_FLAG!$LLVMCC_EMITIR_FLAG$ac_delim
-LLVMCC_DISABLEOPT_FLAGS!$LLVMCC_DISABLEOPT_FLAGS$ac_delim
LLVMCC1!$LLVMCC1$ac_delim
LLVMCC1PLUS!$LLVMCC1PLUS$ac_delim
LLVMGCCDIR!$LLVMGCCDIR$ac_delim
LLVMGCC_LANGS!$LLVMGCC_LANGS$ac_delim
LLVMGCC_DRAGONEGG!$LLVMGCC_DRAGONEGG$ac_delim
+LLVMCC_DISABLEOPT_FLAGS!$LLVMCC_DISABLEOPT_FLAGS$ac_delim
SHLIBEXT!$SHLIBEXT$ac_delim
SHLIBPATH_VAR!$SHLIBPATH_VAR$ac_delim
LLVM_PREFIX!$LLVM_PREFIX$ac_delim
diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in
index 1cc0c7bc76..b38ee62439 100644
--- a/include/llvm/Config/config.h.in
+++ b/include/llvm/Config/config.h.in
@@ -72,6 +72,9 @@
/* Define to 1 if you have the <CrashReporterClient.h> header file. */
#undef HAVE_CRASHREPORTERCLIENT_H
+/* Define if __crashreporter_info__ exists. */
+#undef HAVE_CRASHREPORTER_INFO
+
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
diff --git a/lib/Support/PrettyStackTrace.cpp b/lib/Support/PrettyStackTrace.cpp
index 2f46b9e2b9..cd7c097d35 100644
--- a/lib/Support/PrettyStackTrace.cpp
+++ b/lib/Support/PrettyStackTrace.cpp
@@ -55,7 +55,7 @@ static void PrintCurStackTrace(raw_ostream &OS) {
}
// Integrate with crash reporter libraries.
-#if defined (__APPLE__) && defined (HAVE_CRASHREPORTERCLIENT_H)
+#if defined (__APPLE__) && HAVE_CRASHREPORTERCLIENT_H
// If any clients of llvm try to link to libCrashReporterClient.a themselves,
// only one crash info struct will be used.
extern "C" {
@@ -64,7 +64,7 @@ struct crashreporter_annotations_t gCRAnnotations
__attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION)))
= { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0 };
}
-#elif defined (__APPLE__)
+#elif defined (__APPLE__) && HAVE_CRASHREPORTER_INFO
static const char *__crashreporter_info__ = 0;
asm(".desc ___crashreporter_info__, 0x10");
#endif
@@ -86,11 +86,11 @@ static void CrashHandler(void *) {
}
if (!TmpStr.empty()) {
-#ifndef HAVE_CRASHREPORTERCLIENT_H
- __crashreporter_info__ = strdup(std::string(TmpStr.str()).c_str());
-#else
+#ifdef HAVE_CRASHREPORTERCLIENT_H
// Cast to void to avoid warning.
(void)CRSetCrashLogMessage(std::string(TmpStr.str()).c_str());
+#elif HAVE_CRASHREPORTER_INFO
+ __crashreporter_info__ = strdup(std::string(TmpStr.str()).c_str());
#endif
errs() << TmpStr.str();
}