diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index 952c96fbfea5156d40e1dba87b2d3d2d1ec88241..729123d8bb0e765205ae65dc6c4e034ff6869ef7 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,9 @@
+2012-10-24  Ian Lance Taylor  <iant@google.com>
+
+	PR target/55061
+	* configure.ac: Check whether -funwind-tables option works.
+	* configure: Rebuild.
+
 2012-10-11  Ian Lance Taylor  <iant@google.com>
 
 	* configure.ac: Do not use dl_iterate_phdr on Solaris 10.
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 9a88e8e48e8b31010b2c0ba31d7b4004807e46ad..e27973701868944bfcac393c76a7e966144338fe 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -11490,8 +11490,40 @@ fi
 
 
 EXTRA_FLAGS=
-if test "x$GCC" = "xyes"; then
+if test -n "${with_target_subdir}"; then
   EXTRA_FLAGS=-funwind-tables
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -funwind-tables option" >&5
+$as_echo_n "checking for -funwind-tables option... " >&6; }
+if test "${libbacktrace_cv_c_unwind_tables+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  CFLAGS_hold="$CFLAGS"
+     CFLAGS="$CFLAGS -funwind-tables"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+static int f() { return 0; }
+int
+main ()
+{
+return f();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libbacktrace_cv_c_unwind_tables=yes
+else
+  libbacktrace_cv_c_unwind_tables=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+     CFLAGS="$CFLAGS_hold"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_c_unwind_tables" >&5
+$as_echo "$libbacktrace_cv_c_unwind_tables" >&6; }
+   if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
+     EXTRA_FLAGS=-funwind-tables
+   fi
 fi
 
 
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 9633afd5ac305c6fb952c3031cb820e55f5598d8..6867ecffb896f249f8b7155dbadf38bf1e3c106b 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -97,8 +97,21 @@ fi
 AC_SUBST(BACKTRACE_FILE)
 
 EXTRA_FLAGS=
-if test "x$GCC" = "xyes"; then
+if test -n "${with_target_subdir}"; then
   EXTRA_FLAGS=-funwind-tables
+else
+  AC_CACHE_CHECK([for -funwind-tables option],
+    [libbacktrace_cv_c_unwind_tables],
+    [CFLAGS_hold="$CFLAGS"
+     CFLAGS="$CFLAGS -funwind-tables"
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([static int f() { return 0; }], [return f();])],
+       [libbacktrace_cv_c_unwind_tables=yes],
+       [libbacktrace_cv_c_unwind_tables=no])
+     CFLAGS="$CFLAGS_hold"])
+   if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
+     EXTRA_FLAGS=-funwind-tables
+   fi
 fi
 AC_SUBST(EXTRA_FLAGS)