summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsje <sje@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-09 15:55:38 +0000
committersje <sje@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-09 15:55:38 +0000
commitf406e07ef5dee51738e05a3546ec5af3dd0974c9 (patch)
tree6b262ac07e2b116d237352ff90b639547d322f4a
parent28f1e21fb9fe5d86f401da7faf733b41f83eb5ac (diff)
downloadgcc-f406e07ef5dee51738e05a3546ec5af3dd0974c9.tar.gz
PR target/27880
* unwind-c.c (PERSONALITY_FUNCTION): Ifdef use of _Unwind_GetIPInfo. * configure.ac (HAVE_GETIPINFO): Check for _Unwind_GetIPInfo. * configure: Regenerate. * config.in: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117576 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config.in3
-rwxr-xr-xgcc/configure153
-rw-r--r--gcc/configure.ac20
-rw-r--r--gcc/unwind-c.c4
5 files changed, 188 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a8e057d0074..ac05e546418 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2006-10-09 Steve Ellcey <sje@cup.hp.com>
+
+ PR target/27880
+ * unwind-c.c (PERSONALITY_FUNCTION): Ifdef use of _Unwind_GetIPInfo.
+ * configure.ac (HAVE_GETIPINFO): Check for _Unwind_GetIPInfo.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+
2006-10-09 Aldy Hernandez <aldyh@redhat.com>
* tree-mudflap.c (mf_xform_derefs_1): Add parentheses around TREE_TYPE.
diff --git a/gcc/config.in b/gcc/config.in
index 47ba85080c2..65b583bea4e 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -793,6 +793,9 @@
#endif
+/* Define to 1 if system unwind library has _Unwind_GetIPInfo. */
+#undef HAVE_GETIPINFO
+
/* Define to 1 if you have the `getrlimit' function. */
#ifndef USED_FOR_TARGET
#undef HAVE_GETRLIMIT
diff --git a/gcc/configure b/gcc/configure
index 962778cc1b5..ff7e9c811c7 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -12177,6 +12177,15 @@ if test "${with_system_libunwind+set}" = set; then
fi;
+# config.gcc also contains tests of with_system_libunwind.
+if test x$with_system_libunwind = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETIPINFO 1
+_ACEOF
+
+fi
+
# --------------------------------------------------------
# Build, host, and target specific configuration fragments
# --------------------------------------------------------
@@ -12529,6 +12538,150 @@ _ACEOF
fi
fi
+use_getipinfo=yes
+if test x$with_system_libunwind = xyes; then
+ if test x$host = x$target; then
+ echo "$as_me:$LINENO: checking for library containing _Unwind_GetIPInfo" >&5
+echo $ECHO_N "checking for library containing _Unwind_GetIPInfo... $ECHO_C" >&6
+if test "${ac_cv_search__Unwind_GetIPInfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search__Unwind_GetIPInfo=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _Unwind_GetIPInfo ();
+int
+main ()
+{
+_Unwind_GetIPInfo ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search__Unwind_GetIPInfo="none required"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search__Unwind_GetIPInfo" = no; then
+ for ac_lib in unwind; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _Unwind_GetIPInfo ();
+int
+main ()
+{
+_Unwind_GetIPInfo ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search__Unwind_GetIPInfo="-l$ac_lib"
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search__Unwind_GetIPInfo" >&5
+echo "${ECHO_T}$ac_cv_search__Unwind_GetIPInfo" >&6
+if test "$ac_cv_search__Unwind_GetIPInfo" != no; then
+ test "$ac_cv_search__Unwind_GetIPInfo" = "none required" || LIBS="$ac_cv_search__Unwind_GetIPInfo $LIBS"
+
+else
+ use_getipinfo=no
+fi
+
+ fi
+fi
+
+if test x$use_getipinfo = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETIPINFO 1
+_ACEOF
+
+else
+ echo "The system unwind library does not support _Unwind_GetIPInfo."
+fi
+
# Look for a file containing extra machine modes.
if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
extra_modes_file='$(srcdir)'/config/${extra_modes}
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 5841da9bc87..e502ef5f261 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1229,6 +1229,12 @@ AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
AC_ARG_WITH(system-libunwind,
[ --with-system-libunwind use installed libunwind])
+# config.gcc also contains tests of with_system_libunwind.
+if test x$with_system_libunwind = xyes; then
+ AC_DEFINE(HAVE_GETIPINFO, 1,
+[Define to 1 if system unwind library has _Unwind_GetIPInfo.])
+fi
+
# --------------------------------------------------------
# Build, host, and target specific configuration fragments
# --------------------------------------------------------
@@ -1439,6 +1445,20 @@ if test x$enable___cxa_atexit = xyes || \
fi
fi
+use_getipinfo=yes
+if test x$with_system_libunwind = xyes; then
+ if test x$host = x$target; then
+ AC_SEARCH_LIBS(_Unwind_GetIPInfo, unwind,, [use_getipinfo=no])
+ fi
+fi
+GCC_TARGET_TEMPLATE(HAVE_GETIPINFO)
+if test x$use_getipinfo = xyes; then
+ AC_DEFINE(HAVE_GETIPINFO, 1,
+ [Define to 1 if system unwind library has _Unwind_GetIPInfo.])
+else
+ echo "The system unwind library does not support _Unwind_GetIPInfo."
+fi
+
# Look for a file containing extra machine modes.
if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
extra_modes_file='$(srcdir)'/config/${extra_modes}
diff --git a/gcc/unwind-c.c b/gcc/unwind-c.c
index cf17b6174d2..c8f34acc0ee 100644
--- a/gcc/unwind-c.c
+++ b/gcc/unwind-c.c
@@ -157,7 +157,11 @@ PERSONALITY_FUNCTION (int version,
/* Parse the LSDA header. */
p = parse_lsda_header (context, language_specific_data, &info);
+#ifdef HAVE_GETIPINFO
ip = _Unwind_GetIPInfo (context, &ip_before_insn);
+#else
+ ip = _Unwind_GetIP (context);
+#endif
if (! ip_before_insn)
--ip;
landing_pad = 0;