re PR target/26792 (need to use autoconf when using newly-added libgcc functions)
authorJack Howarth <howarth@bromo.med.uc.edu>
Wed, 27 Sep 2006 21:24:23 +0000 (21:24 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 27 Sep 2006 21:24:23 +0000 (21:24 +0000)
2006-09-26  Jack Howarth  <howarth@bromo.med.uc.edu>

PR target/26792:
* exception.cc (PERSONALITY_FUNCTION): use _Unwind_GetIP
if HAVE_GETIPINFO not defined.
* stacktrace.cc (_Jv_StackTrace::UnwindTraceFn): Likewise.
(_Jv_StackTrace::getLineNumberForFrame): Likewise.
* configure.ac: use GCC_CHECK_UNWIND_GETIPINFO.
* aclocal.m4, configure, include/config.h.in, Makefile.in:
Rebuilt.

From-SVN: r117259

libjava/ChangeLog
libjava/Makefile.in
libjava/aclocal.m4
libjava/configure
libjava/configure.ac
libjava/exception.cc
libjava/gcj/Makefile.in
libjava/include/Makefile.in
libjava/include/config.h.in
libjava/stacktrace.cc
libjava/testsuite/Makefile.in

index c54f4ee..33b21ce 100644 (file)
@@ -1,3 +1,14 @@
+2006-09-26  Jack Howarth  <howarth@bromo.med.uc.edu>
+
+       PR target/26792:
+       * exception.cc (PERSONALITY_FUNCTION): use _Unwind_GetIP
+       if HAVE_GETIPINFO not defined.
+       * stacktrace.cc (_Jv_StackTrace::UnwindTraceFn): Likewise.
+       (_Jv_StackTrace::getLineNumberForFrame): Likewise.
+       * configure.ac: use GCC_CHECK_UNWIND_GETIPINFO.
+       * aclocal.m4, configure, include/config.h.in, Makefile.in:
+       Rebuilt.
+
 2006-09-27  Tom Tromey  <tromey@redhat.com>
 
        https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=201712
index e81560c..d514fcb 100644 (file)
@@ -82,9 +82,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/lib-link.m4 \
        $(top_srcdir)/../config/lib-prefix.m4 \
        $(top_srcdir)/../config/no-executables.m4 \
-       $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/mingwld.m4 $(top_srcdir)/pkg.m4 \
-       $(top_srcdir)/shlibpath.m4 $(top_srcdir)/configure.ac
+       $(top_srcdir)/../config/tls.m4 \
+       $(top_srcdir)/../config/unwind_ipinfo.m4 \
+       $(top_srcdir)/../libtool.m4 $(top_srcdir)/mingwld.m4 \
+       $(top_srcdir)/pkg.m4 $(top_srcdir)/shlibpath.m4 \
+       $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
index 7ac7bbc..3ba911b 100644 (file)
@@ -915,6 +915,7 @@ m4_include([../config/lib-link.m4])
 m4_include([../config/lib-prefix.m4])
 m4_include([../config/no-executables.m4])
 m4_include([../config/tls.m4])
+m4_include([../config/unwind_ipinfo.m4])
 m4_include([../libtool.m4])
 m4_include([mingwld.m4])
 m4_include([pkg.m4])
index 17dda7c..910850d 100755 (executable)
@@ -16496,7 +16496,7 @@ case "${host}" in
  mips*-*-linux*)
     SIGNAL_HANDLER=include/mips-signal.h
     ;;
- *-*-darwin*)
powerpc*-*-darwin*)
     SIGNAL_HANDLER=include/darwin-signal.h
     ;;
  *)
@@ -16654,6 +16654,96 @@ _ACEOF
 
   fi
 
+# For _Unwind_GetIPInfo.
+
+
+
+  ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -fno-exceptions"
+  echo "$as_me:$LINENO: checking for _Unwind_GetIPInfo" >&5
+echo $ECHO_N "checking for _Unwind_GetIPInfo... $ECHO_C" >&6
+  if test "${gcc_cv_getipinfo+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+  if test x$gcc_no_link = xyes; then
+  { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+extern "C" { extern void _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_cxx_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
+  gcc_cv_getipinfo=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gcc_cv_getipinfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+  if test $gcc_cv_getipinfo = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETIPINFO 1
+_ACEOF
+
+  fi
+  echo "$as_me:$LINENO: result: $gcc_cv_getipinfo" >&5
+echo "${ECHO_T}$gcc_cv_getipinfo" >&6
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
 # Check if linker supports static linking on a per library basis
 LD_START_STATIC_SPEC=
 LD_FINISH_STATIC_SPEC=
index 6645723..ace631a 100644 (file)
@@ -1480,6 +1480,9 @@ fi
 # See if we support thread-local storage.
 GCC_CHECK_TLS
 
+# For _Unwind_GetIPInfo.
+GCC_CHECK_UNWIND_GETIPINFO
+
 # Check if linker supports static linking on a per library basis
 LD_START_STATIC_SPEC=
 LD_FINISH_STATIC_SPEC=
index 65bc4ed..3d8fda1 100644 (file)
@@ -231,9 +231,13 @@ 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);
   if (! ip_before_insn)
     --ip;
+#else
+  ip = _Unwind_GetIP (context) - 1;
+#endif
   landing_pad = 0;
   action_record = 0;
   handler_switch_value = 0;
index 116620f..5236544 100644 (file)
@@ -53,9 +53,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/lib-link.m4 \
        $(top_srcdir)/../config/lib-prefix.m4 \
        $(top_srcdir)/../config/no-executables.m4 \
-       $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/mingwld.m4 $(top_srcdir)/pkg.m4 \
-       $(top_srcdir)/shlibpath.m4 $(top_srcdir)/configure.ac
+       $(top_srcdir)/../config/tls.m4 \
+       $(top_srcdir)/../config/unwind_ipinfo.m4 \
+       $(top_srcdir)/../libtool.m4 $(top_srcdir)/mingwld.m4 \
+       $(top_srcdir)/pkg.m4 $(top_srcdir)/shlibpath.m4 \
+       $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 CONFIG_HEADER = $(top_builddir)/include/config.h libgcj-config.h
index a101827..26c8ce9 100644 (file)
@@ -52,9 +52,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/lib-link.m4 \
        $(top_srcdir)/../config/lib-prefix.m4 \
        $(top_srcdir)/../config/no-executables.m4 \
-       $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/mingwld.m4 $(top_srcdir)/pkg.m4 \
-       $(top_srcdir)/shlibpath.m4 $(top_srcdir)/configure.ac
+       $(top_srcdir)/../config/tls.m4 \
+       $(top_srcdir)/../config/unwind_ipinfo.m4 \
+       $(top_srcdir)/../libtool.m4 $(top_srcdir)/mingwld.m4 \
+       $(top_srcdir)/pkg.m4 $(top_srcdir)/shlibpath.m4 \
+       $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 CONFIG_HEADER = config.h $(top_builddir)/gcj/libgcj-config.h
index e6ea394..a8ebfad 100644 (file)
 /* Define to 1 if you have the `getifaddrs' function. */
 #undef HAVE_GETIFADDRS
 
+/* Define if _Unwind_GetIPInfo is available. */
+#undef HAVE_GETIPINFO
+
 /* Define to 1 if you have the `getpwuid_r' function. */
 #undef HAVE_GETPWUID_R
 
index 3e6f04c..7f967ba 100644 (file)
@@ -131,6 +131,7 @@ _Jv_StackTrace::UnwindTraceFn (struct _Unwind_Context *context, void *state_ptr)
   else
 #endif
     {
+#ifdef HAVE_GETIPINFO
       _Unwind_Ptr ip;
       int ip_before_insn = 0;
       ip = _Unwind_GetIPInfo (context, &ip_before_insn);
@@ -139,9 +140,13 @@ _Jv_StackTrace::UnwindTraceFn (struct _Unwind_Context *context, void *state_ptr)
       // to ensure we get the correct line number for the call itself.
       if (! ip_before_insn)
        --ip;
-
+#endif
       state->frames[pos].type = frame_native;
+#ifdef HAVE_GETIPINFO
       state->frames[pos].ip = (void *) ip;
+#else
+      state->frames[pos].ip = (void *) _Unwind_GetIP (context);
+#endif
       state->frames[pos].start_ip = func_addr;
     }
 
@@ -217,6 +222,12 @@ _Jv_StackTrace::getLineNumberForFrame(_Jv_StackFrame *frame, NameFinder *finder,
       else
         offset = (_Unwind_Ptr) ip - (_Unwind_Ptr) info.base;
 
+#ifndef HAVE_GETIPINFO
+      // The unwinder gives us the return address. In order to get the right
+      // line number for the stack trace, roll it back a little.
+      offset -= 1;
+#endif
+
       finder->lookup (binaryName, (jlong) offset);
       *sourceFileName = finder->getSourceFile();
       *lineNum = finder->getLineNum();
index 485b8ea..f419d3c 100644 (file)
@@ -50,9 +50,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/lib-link.m4 \
        $(top_srcdir)/../config/lib-prefix.m4 \
        $(top_srcdir)/../config/no-executables.m4 \
-       $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/mingwld.m4 $(top_srcdir)/pkg.m4 \
-       $(top_srcdir)/shlibpath.m4 $(top_srcdir)/configure.ac
+       $(top_srcdir)/../config/tls.m4 \
+       $(top_srcdir)/../config/unwind_ipinfo.m4 \
+       $(top_srcdir)/../libtool.m4 $(top_srcdir)/mingwld.m4 \
+       $(top_srcdir)/pkg.m4 $(top_srcdir)/shlibpath.m4 \
+       $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 CONFIG_HEADER = $(top_builddir)/include/config.h \