From ca4667319a2936965128cdc331601ff229022058 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 3 Dec 2010 07:45:22 +0000 Subject: [PATCH] Apparently OS X 10.4 doesn't have __crashreporter_info__. Try to fix building on the wayback machine. llvm-svn: 120801 --- llvm/autoconf/configure.ac | 10 +++- llvm/configure | 75 +++++++++++++++++++++++++-- llvm/include/llvm/Config/config.h.in | 3 ++ llvm/lib/Support/PrettyStackTrace.cpp | 10 ++-- 4 files changed, 89 insertions(+), 9 deletions(-) diff --git a/llvm/autoconf/configure.ac b/llvm/autoconf/configure.ac index ee58d8e9e81a..b8d4a30715a5 100644 --- a/llvm/autoconf/configure.ac +++ b/llvm/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/llvm/configure b/llvm/configure index ea8d1f20ac5e..88fe0fddaa2b 100755 --- a/llvm/configure +++ b/llvm/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 <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/llvm/include/llvm/Config/config.h.in b/llvm/include/llvm/Config/config.h.in index 1cc0c7bc767c..b38ee62439b6 100644 --- a/llvm/include/llvm/Config/config.h.in +++ b/llvm/include/llvm/Config/config.h.in @@ -72,6 +72,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CRASHREPORTERCLIENT_H +/* Define if __crashreporter_info__ exists. */ +#undef HAVE_CRASHREPORTER_INFO + /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H diff --git a/llvm/lib/Support/PrettyStackTrace.cpp b/llvm/lib/Support/PrettyStackTrace.cpp index 2f46b9e2b982..cd7c097d35dc 100644 --- a/llvm/lib/Support/PrettyStackTrace.cpp +++ b/llvm/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(); }