From f4e749b49840f856b460fdf2a8e501d4436fbc16 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 14 Mar 2011 19:47:58 +0000 Subject: [PATCH] unwind-dw2.c: Include sys/sdt.h if it exists. * 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. From-SVN: r170954 --- gcc/ChangeLog | 7 +++++++ gcc/config.in | 3 +++ gcc/configure | 13 +++++++++++++ gcc/configure.ac | 10 ++++++++++ gcc/unwind-dw2.c | 12 +++++++++++- 5 files changed, 44 insertions(+), 1 deletion(-) 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 + + * 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 * 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 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 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 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 +#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