summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-14 19:47:58 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-14 19:47:58 +0000
commitf77bcf966ea0eb37e18421a296d7a57316e6a03f (patch)
treea7d216e75ae40a2e56ee400b56f3a35b1d77e17b
parent475f05b7d9b813884ecab35dbd691cc3ee19c1c2 (diff)
downloadgcc-f77bcf966ea0eb37e18421a296d7a57316e6a03f.tar.gz
* unwind-dw2.c: Include sys/sdt.h if it exists.
(_Unwind_DebugHook): Use STAP_PROBE2. * config.in, configure: Rebuild. * configure.ac: Check for sys/sdt.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170954 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config.in3
-rwxr-xr-xgcc/configure13
-rw-r--r--gcc/configure.ac10
-rw-r--r--gcc/unwind-dw2.c12
5 files changed, 44 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9a4f888359a..0c9102c8fbc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2011-01-14 Tom Tromey <tromey@redhat.com>
+
+ * unwind-dw2.c: Include sys/sdt.h if it exists.
+ (_Unwind_DebugHook): Use STAP_PROBE2.
+ * config.in, configure: Rebuild.
+ * configure.ac: Check for sys/sdt.h.
+
2011-03-14 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (ROUND_FLOOR): New constant.
diff --git a/gcc/config.in b/gcc/config.in
index 584ec65b2b7..7604b687a89 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1408,6 +1408,9 @@
#endif
+/* Define if your target C library provides sys/sdt.h */
+#undef HAVE_SYS_SDT_H
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#ifndef USED_FOR_TARGET
#undef HAVE_SYS_STAT_H
diff --git a/gcc/configure b/gcc/configure
index a4549469816..e5e6164102c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -25792,6 +25792,19 @@ $as_echo "#define TARGET_LIBC_PROVIDES_SSP 1" >>confdefs.h
fi
+# Test for <sys/sdt.h> on the target.
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
+$as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
+have_sys_sdt_h=no
+if test -f $target_header_dir/sys/sdt.h; then
+
+$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
+$as_echo "$have_sys_sdt_h" >&6; }
+
# Check if TFmode long double should be used by default or not.
# Some glibc targets used DFmode long double, but with glibc 2.4
# and later they can use TFmode.
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 03a8cef47d6..fd4dd464474 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4381,6 +4381,16 @@ if test x$gcc_cv_libc_provides_ssp = xyes; then
[Define if your target C library provides stack protector support])
fi
+# Test for <sys/sdt.h> on the target.
+GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
+AC_MSG_CHECKING(sys/sdt.h in the target C library)
+have_sys_sdt_h=no
+if test -f $target_header_dir/sys/sdt.h; then
+ AC_DEFINE(HAVE_SYS_SDT_H, 1,
+ [Define if your target C library provides sys/sdt.h])
+fi
+AC_MSG_RESULT($have_sys_sdt_h)
+
# Check if TFmode long double should be used by default or not.
# Some glibc targets used DFmode long double, but with glibc 2.4
# and later they can use TFmode.
diff --git a/gcc/unwind-dw2.c b/gcc/unwind-dw2.c
index 2ea9adb06ea..25990b4e73b 100644
--- a/gcc/unwind-dw2.c
+++ b/gcc/unwind-dw2.c
@@ -1,6 +1,6 @@
/* DWARF2 exception handling and frame unwind runtime interface routines.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2008, 2009, 2010 Free Software Foundation, Inc.
+ 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -37,6 +37,10 @@
#include "gthr.h"
#include "unwind-dw2.h"
+#ifdef HAVE_SYS_SDT_H
+#include <sys/sdt.h>
+#endif
+
#ifndef __USING_SJLJ_EXCEPTIONS__
#ifndef STACK_GROWS_DOWNWARD
@@ -1493,7 +1497,13 @@ static void
_Unwind_DebugHook (void *cfa __attribute__ ((__unused__)),
void *handler __attribute__ ((__unused__)))
{
+ /* We only want to use stap probes starting with v3. Earlier
+ versions added too much startup cost. */
+#if defined (HAVE_SYS_SDT_H) && defined (STAP_PROBE2) && _SDT_NOTE_TYPE >= 3
+ STAP_PROBE2 (libgcc, unwind, cfa, handler);
+#else
asm ("");
+#endif
}
/* Install TARGET into CURRENT so that we can return to it. This is a