26b6b52
diff -Nrup a/scripts/check-local-headers.sh b/scripts/check-local-headers.sh
26b6b52
--- a/scripts/check-local-headers.sh	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/scripts/check-local-headers.sh	2012-01-01 20:41:26.683439836 -0700
26b6b52
@@ -29,7 +29,7 @@ exec ${AWK} -v includedir="$includedir"
26b6b52
 BEGIN {
26b6b52
   status = 0
26b6b52
   exclude = "^" includedir \
26b6b52
-    "/(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h|libaudit\\.h)"
26b6b52
+    "/(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h|libaudit\\.h|sys/sdt(-config)?\\.h))"
26b6b52
 }
26b6b52
 /^[^ ]/ && $1 ~ /.*:/ { obj = $1 }
26b6b52
 {
26b6b52
diff -Nrup a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
26b6b52
--- a/sysdeps/i386/__longjmp.S	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/sysdeps/i386/__longjmp.S	2012-01-01 20:41:26.686439835 -0700
26b6b52
@@ -1,5 +1,5 @@
26b6b52
 /* longjmp for i386.
26b6b52
-   Copyright (C) 1995-1998,2000,2002,2005,2006,2009
26b6b52
+   Copyright (C) 1995-1998,2000,2002,2005,2006,2009,2011
26b6b52
    Free Software Foundation, Inc.
26b6b52
    This file is part of the GNU C Library.
26b6b52
 
26b6b52
@@ -21,6 +21,7 @@
26b6b52
 #include <sysdep.h>
26b6b52
 #include <jmpbuf-offsets.h>
26b6b52
 #include <asm-syntax.h>
26b6b52
+#include <stap-probe.h>
26b6b52
 
26b6b52
 	.text
26b6b52
 ENTRY (__longjmp)
26b6b52
@@ -33,6 +34,7 @@ ENTRY (__longjmp)
26b6b52
 	movl (JB_SP*4)(%eax), %ecx
26b6b52
 	PTR_DEMANGLE (%edx)
26b6b52
 	PTR_DEMANGLE (%ecx)
26b6b52
+	LIBC_PROBE (longjmp, 3, 4@%eax, -4@8(%esp), 4@%edx)
26b6b52
 	cfi_def_cfa(%eax, 0)
26b6b52
 	cfi_register(%eip, %edx)
26b6b52
 	cfi_register(%esp, %ecx)
26b6b52
@@ -50,6 +52,7 @@ ENTRY (__longjmp)
26b6b52
 	cfi_restore(%edi)
26b6b52
 	cfi_restore(%ebp)
26b6b52
 
26b6b52
+	LIBC_PROBE (longjmp_target, 3, 4@%eax, -4@8(%esp), 4@%edx)
26b6b52
 	movl 8(%esp), %eax	/* Second argument is return value.  */
26b6b52
 	movl %ecx, %esp
26b6b52
 #else
26b6b52
@@ -57,12 +60,14 @@ ENTRY (__longjmp)
26b6b52
 	movl 8(%esp), %eax	/* Second argument is return value.  */
26b6b52
 	/* Save the return address now.  */
26b6b52
 	movl (JB_PC*4)(%ecx), %edx
26b6b52
+	LIBC_PROBE (longjmp, 3, 4@%ecx, -4@%eax, 4@%edx)
26b6b52
      	/* Restore registers.  */
26b6b52
 	movl (JB_BX*4)(%ecx), %ebx
26b6b52
 	movl (JB_SI*4)(%ecx), %esi
26b6b52
 	movl (JB_DI*4)(%ecx), %edi
26b6b52
 	movl (JB_BP*4)(%ecx), %ebp
26b6b52
 	movl (JB_SP*4)(%ecx), %esp
26b6b52
+	LIBC_PROBE (longjmp_target, 3, 4@%ecx, -4@%ecx, 4@%edx)
26b6b52
 #endif
26b6b52
 	/* Jump to saved PC.  */
26b6b52
      	jmp *%edx
26b6b52
diff -Nrup a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S
26b6b52
--- a/sysdeps/i386/bsd-_setjmp.S	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/sysdeps/i386/bsd-_setjmp.S	2012-01-01 20:41:26.686439835 -0700
26b6b52
@@ -1,5 +1,6 @@
26b6b52
 /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  i386 version.
26b6b52
-   Copyright (C) 1994-1997,2000-2002,2005, 2006 Free Software Foundation, Inc.
26b6b52
+   Copyright (C) 1994-1997,2000-2002,2005,2006,2011
26b6b52
+	Free Software Foundation, Inc.
26b6b52
    This file is part of the GNU C Library.
26b6b52
 
26b6b52
    The GNU C Library is free software; you can redistribute it and/or
26b6b52
@@ -25,6 +26,7 @@
26b6b52
 #include <jmpbuf-offsets.h>
26b6b52
 #include "bp-sym.h"
26b6b52
 #include "bp-asm.h"
26b6b52
+#include <stap-probe.h>
26b6b52
 
26b6b52
 #define PARMS	LINKAGE		/* no space for saved regs */
26b6b52
 #define JMPBUF	PARMS
26b6b52
@@ -47,6 +49,7 @@ ENTRY (BP_SYM (_setjmp))
26b6b52
 #endif
26b6b52
      	movl %ecx, (JB_SP*4)(%edx)
26b6b52
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
26b6b52
+	LIBC_PROBE (setjmp, 3, 4@%edx, -4@$0, 4@%ecx)
26b6b52
 #ifdef PTR_MANGLE
26b6b52
 	PTR_MANGLE (%ecx)
26b6b52
 #endif
26b6b52
diff -Nrup a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S
26b6b52
--- a/sysdeps/i386/bsd-setjmp.S	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/sysdeps/i386/bsd-setjmp.S	2012-01-01 20:41:26.687439834 -0700
26b6b52
@@ -1,5 +1,6 @@
26b6b52
 /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  i386 version.
26b6b52
-   Copyright (C) 1994-1997,2000,2001,2005, 2006 Free Software Foundation, Inc.
26b6b52
+   Copyright (C) 1994-1997,2000,2001,2005,2006,2011
26b6b52
+	Free Software Foundation, Inc.
26b6b52
    This file is part of the GNU C Library.
26b6b52
 
26b6b52
    The GNU C Library is free software; you can redistribute it and/or
26b6b52
@@ -25,6 +26,7 @@
26b6b52
 #include <jmpbuf-offsets.h>
26b6b52
 #include "bp-sym.h"
26b6b52
 #include "bp-asm.h"
26b6b52
+#include <stap-probe.h>
26b6b52
 
26b6b52
 #define PARMS  LINKAGE		/* no space for saved regs */
26b6b52
 #define JMPBUF PARMS
26b6b52
@@ -49,6 +51,7 @@ ENTRY (BP_SYM (setjmp))
26b6b52
 #endif
26b6b52
      	movl %ecx, (JB_SP*4)(%eax)
26b6b52
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
26b6b52
+	LIBC_PROBE (setjmp, 3, 4@%eax, -4@$1, 4@%ecx)
26b6b52
 #ifdef PTR_MANGLE
26b6b52
 	PTR_MANGLE (%ecx)
26b6b52
 #endif
26b6b52
diff -Nrup a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
26b6b52
--- a/sysdeps/i386/setjmp.S	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/sysdeps/i386/setjmp.S	2012-01-01 20:41:26.687439834 -0700
26b6b52
@@ -1,5 +1,5 @@
26b6b52
 /* setjmp for i386.
26b6b52
-   Copyright (C) 1995,1996,1997,2000,2001,2005,2006
26b6b52
+   Copyright (C) 1995,1996,1997,2000,2001,2005,2006,2011
26b6b52
 	Free Software Foundation, Inc.
26b6b52
    This file is part of the GNU C Library.
26b6b52
 
26b6b52
@@ -23,6 +23,7 @@
26b6b52
 #include <asm-syntax.h>
26b6b52
 #include "bp-sym.h"
26b6b52
 #include "bp-asm.h"
26b6b52
+#include <stap-probe.h>
26b6b52
 
26b6b52
 #define PARMS	LINKAGE		/* no space for saved regs */
26b6b52
 #define JMPBUF	PARMS
26b6b52
@@ -44,6 +45,7 @@ ENTRY (BP_SYM (__sigsetjmp))
26b6b52
 #endif
26b6b52
      	movl %ecx, (JB_SP*4)(%eax)
26b6b52
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
26b6b52
+	LIBC_PROBE (setjmp, 3, 4@%eax, -4@SIGMSK(%esp), 4@%ecx)
26b6b52
 #ifdef PTR_MANGLE
26b6b52
 	PTR_MANGLE (%ecx)
26b6b52
 #endif
26b6b52
diff -Nrup a/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S b/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S
26b6b52
--- a/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S	2012-01-01 20:41:26.699439832 -0700
26b6b52
@@ -1,4 +1,5 @@
26b6b52
-/* Copyright (C) 2001,2004,2005,2006,2009 Free Software Foundation, Inc.
26b6b52
+/* Copyright (C) 2001,2004,2005,2006,2009,2011
26b6b52
+	Free Software Foundation, Inc.
26b6b52
    This file is part of the GNU C Library.
26b6b52
 
26b6b52
    The GNU C Library is free software; you can redistribute it and/or
26b6b52
@@ -19,6 +20,7 @@
26b6b52
 #include <sysdep.h>
26b6b52
 #include <jmpbuf-offsets.h>
26b6b52
 #include <asm-syntax.h>
26b6b52
+#include <stap-probe.h>
26b6b52
 
26b6b52
 
26b6b52
 	.section .rodata.str1.1,"aMS",@progbits,1
26b6b52
@@ -79,7 +81,9 @@ ENTRY (____longjmp_chk)
26b6b52
 	cfi_adjust_cfa_offset(-12)
26b6b52
 	movl	4(%esp), %ecx
26b6b52
 
26b6b52
-.Lok:	/* We add unwind information for the target here.  */
26b6b52
+.Lok:
26b6b52
+	LIBC_PROBE (longjmp, 3, 4@%ecx, -4@8(%esp), 4@%edx)
26b6b52
+	/* We add unwind information for the target here.  */
26b6b52
 	cfi_def_cfa(%ecx, 0)
26b6b52
 	cfi_register(%eip, %edx)
26b6b52
 	cfi_register(%esp, %edi)
26b6b52
@@ -102,5 +106,6 @@ ENTRY (____longjmp_chk)
26b6b52
 	cfi_restore(%ebp)
26b6b52
 
26b6b52
 	/* Jump to saved PC.  */
26b6b52
+	LIBC_PROBE (longjmp_target, 3, 4@%ecx, -4@%eax, 4@%edx)
26b6b52
 	jmp	*%edx
26b6b52
 END (____longjmp_chk)
26b6b52
diff -Nrup a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
26b6b52
--- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S	2012-01-01 20:41:26.703439831 -0700
26b6b52
@@ -19,6 +19,7 @@
26b6b52
 #include <sysdep.h>
26b6b52
 #include <jmpbuf-offsets.h>
26b6b52
 #include <asm-syntax.h>
26b6b52
+#include <stap-probe.h>
26b6b52
 
26b6b52
 	.section .rodata.str1.1,"aMS",@progbits,1
26b6b52
 	.type	longjmp_msg,@object
26b6b52
@@ -94,7 +95,9 @@ ENTRY(____longjmp_chk)
26b6b52
 	movl	%ebx, %esi
26b6b52
 	cfi_restore (%rsi)
26b6b52
 
26b6b52
-.Lok:	/* We add unwind information for the target here.  */
26b6b52
+.Lok:
26b6b52
+	LIBC_PROBE (longjmp, 3, 8@%rdi, -4@%esi, 8@%rdx)
26b6b52
+	/* We add unwind information for the target here.  */
26b6b52
 	cfi_def_cfa(%rdi, 0)
26b6b52
 	cfi_register(%rsp,%r8)
26b6b52
 	cfi_register(%rbp,%r9)
26b6b52
@@ -113,5 +116,6 @@ ENTRY(____longjmp_chk)
26b6b52
 	movl	%esi, %eax
26b6b52
 	movq	%r8,%rsp
26b6b52
 	movq	%r9,%rbp
26b6b52
+	LIBC_PROBE (longjmp_target, 3, 8@%rdi, -4@%eax, 8@%rdx)
26b6b52
 	jmpq	*%rdx
26b6b52
 END (____longjmp_chk)
26b6b52
diff -Nrup a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
26b6b52
--- a/sysdeps/x86_64/__longjmp.S	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/sysdeps/x86_64/__longjmp.S	2012-01-01 20:41:26.703439831 -0700
26b6b52
@@ -1,4 +1,4 @@
26b6b52
-/* Copyright (C) 2001,2004,2005,2006,2009 Free Software Foundation, Inc.
26b6b52
+/* Copyright (C) 2001,2004,2005,2006,2009,2011 Free Software Foundation, Inc.
26b6b52
    This file is part of the GNU C Library.
26b6b52
 
26b6b52
    The GNU C Library is free software; you can redistribute it and/or
26b6b52
@@ -19,6 +19,7 @@
26b6b52
 #include <sysdep.h>
26b6b52
 #include <jmpbuf-offsets.h>
26b6b52
 #include <asm-syntax.h>
26b6b52
+#include <stap-probe.h>
26b6b52
 
26b6b52
 /* Jump to the position specified by ENV, causing the
26b6b52
    setjmp call there to return VAL, or 1 if VAL is 0.
26b6b52
@@ -34,6 +35,7 @@ ENTRY(__longjmp)
26b6b52
 	PTR_DEMANGLE (%r9)
26b6b52
 	PTR_DEMANGLE (%rdx)
26b6b52
 #endif
26b6b52
+	LIBC_PROBE (longjmp, 3, 8@%rdi, -4@%esi, 8@%rdx)
26b6b52
 	/* We add unwind information for the target here.  */
26b6b52
 	cfi_def_cfa(%rdi, 0)
26b6b52
 	cfi_register(%rsp,%r8)
26b6b52
@@ -53,5 +55,6 @@ ENTRY(__longjmp)
26b6b52
 	mov %esi, %eax
26b6b52
 	movq %r8,%rsp
26b6b52
 	movq %r9,%rbp
26b6b52
+	LIBC_PROBE (longjmp_target, 3, 8@%rdi, -4@%eax, 8@%rdx)
26b6b52
 	jmpq *%rdx
26b6b52
 END (__longjmp)
26b6b52
diff -Nrup a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
26b6b52
--- a/sysdeps/x86_64/setjmp.S	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/sysdeps/x86_64/setjmp.S	2012-01-01 20:41:26.704439831 -0700
26b6b52
@@ -1,5 +1,5 @@
26b6b52
 /* setjmp for x86-64.
26b6b52
-   Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
26b6b52
+   Copyright (C) 2001,2003,2005,2006,2011 Free Software Foundation, Inc.
26b6b52
    This file is part of the GNU C Library.
26b6b52
 
26b6b52
    The GNU C Library is free software; you can redistribute it and/or
26b6b52
@@ -20,6 +20,7 @@
26b6b52
 #include <sysdep.h>
26b6b52
 #include <jmpbuf-offsets.h>
26b6b52
 #include <asm-syntax.h>
26b6b52
+#include <stap-probe.h>
26b6b52
 
26b6b52
 ENTRY (__sigsetjmp)
26b6b52
 	/* Save registers.  */
26b6b52
@@ -41,6 +42,7 @@ ENTRY (__sigsetjmp)
26b6b52
 #endif
26b6b52
 	movq %rdx, (JB_RSP*8)(%rdi)
26b6b52
 	movq (%rsp), %rax	/* Save PC we are returning to now.  */
26b6b52
+	LIBC_PROBE (setjmp, 3, 8@%rdi, -4@%esi, 8@%rax)
26b6b52
 #ifdef PTR_MANGLE
26b6b52
 	PTR_MANGLE (%rax)
26b6b52
 #endif
26b6b52
diff -Nrup a/include/stap-probe.h b/include/stap-probe.h
26b6b52
--- a/include/stap-probe.h	1969-12-31 17:00:00.000000000 -0700
26b6b52
+++ b/include/stap-probe.h	2012-01-01 20:41:26.646439841 -0700
26b6b52
@@ -0,0 +1,140 @@
26b6b52
+/* Macros for defining Systemtap <sys/sdt.h> static probe points.
26b6b52
+   Copyright (C) 2011 Free Software Foundation, Inc.
26b6b52
+   This file is part of the GNU C Library.
26b6b52
+
26b6b52
+   The GNU C Library is free software; you can redistribute it and/or
26b6b52
+   modify it under the terms of the GNU Lesser General Public
26b6b52
+   License as published by the Free Software Foundation; either
26b6b52
+   version 2.1 of the License, or (at your option) any later version.
26b6b52
+
26b6b52
+   The GNU C Library is distributed in the hope that it will be useful,
26b6b52
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
26b6b52
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26b6b52
+   Lesser General Public License for more details.
26b6b52
+
26b6b52
+   You should have received a copy of the GNU Lesser General Public
26b6b52
+   License along with the GNU C Library; if not, write to the Free
26b6b52
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26b6b52
+   02111-1307 USA.  */
26b6b52
+
26b6b52
+#ifndef _STAP_PROBE_H
26b6b52
+#define _STAP_PROBE_H 1
26b6b52
+
26b6b52
+#ifdef USE_STAP_PROBE
26b6b52
+
26b6b52
+# include <sys/sdt.h>
26b6b52
+
26b6b52
+/* Our code uses one macro LIBC_PROBE (name, n, arg1, ..., argn).
26b6b52
+
26b6b52
+   Without USE_STAP_PROBE, that does nothing but evaluates all
26b6b52
+   its arguments (to prevent bit rot, unlike e.g. assert).
26b6b52
+
26b6b52
+   Systemtap's header defines the macros STAP_PROBE (provider, name) and
26b6b52
+   STAP_PROBEn (provider, name, arg1, ..., argn).  For "provider" we paste
26b6b52
+   in the IN_LIB name (libc, libpthread, etc.) automagically.  */
26b6b52
+
26b6b52
+# ifndef NOT_IN_libc
26b6b52
+#  define IN_LIB	libc
26b6b52
+# elif !defined IN_LIB
26b6b52
+/* This is intentionally defined with extra unquoted commas in it so
26b6b52
+   that macro substitution will bomb out when it is used.  We don't
26b6b52
+   just use #error here, so that this header can be included by
26b6b52
+   other headers that use LIBC_PROBE inside their own macros.  We
26b6b52
+   only want such headers to fail to compile if those macros are
26b6b52
+   actually used in a context where IN_LIB has not been defined.  */
26b6b52
+#  define IN_LIB	,,,missing -DIN_LIB=... -- not extra-lib.mk?,,,
26b6b52
+# endif
26b6b52
+
26b6b52
+# define LIBC_PROBE(name, n, ...)	\
26b6b52
+  LIBC_PROBE_1 (IN_LIB, name, n, ## __VA_ARGS__)
26b6b52
+
26b6b52
+# define LIBC_PROBE_1(lib, name, n, ...) \
26b6b52
+  STAP_PROBE##n (lib, name, ## __VA_ARGS__)
26b6b52
+
26b6b52
+# define STAP_PROBE0		STAP_PROBE
26b6b52
+
26b6b52
+# define LIBC_PROBE_ASM(name, template) \
26b6b52
+  STAP_PROBE_ASM (IN_LIB, name, template)
26b6b52
+
26b6b52
+# define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
26b6b52
+
26b6b52
+#else  /* Not USE_STAP_PROBE.  */
26b6b52
+
26b6b52
+# ifndef __ASSEMBLER__
26b6b52
+#  define LIBC_PROBE(name, n, ...)		DUMMY_PROBE##n (__VA_ARGS__)
26b6b52
+# else
26b6b52
+#  define LIBC_PROBE(name, n, ...)		/* Nothing.  */
26b6b52
+# endif
26b6b52
+
26b6b52
+# define LIBC_PROBE_ASM(name, template)		/* Nothing.  */
26b6b52
+# define LIBC_PROBE_ASM_OPERANDS(n, ...)	/* Nothing.  */
26b6b52
+
26b6b52
+/* This silliness lets us evaluate all the arguments for each arity
26b6b52
+   of probe.  My kingdom for a real macro system.  */
26b6b52
+
26b6b52
+# define DUMMY_PROBE0()			do {} while (0)
26b6b52
+# define DUMMY_PROBE1(a1)		do {} while ((void) (a1), 0)
26b6b52
+# define DUMMY_PROBE2(a1, a2)		do {} while ((void) (a1), \
26b6b52
+						     (void) (a2), 0)
26b6b52
+# define DUMMY_PROBE3(a1, a2, a3)	do {} while ((void) (a1), \
26b6b52
+						     (void) (a2), \
26b6b52
+						     (void) (a3), 0)
26b6b52
+# define DUMMY_PROBE4(a1, a2, a3, a4)	do {} while ((void) (a1), \
26b6b52
+						     (void) (a2), \
26b6b52
+						     (void) (a3), \
26b6b52
+						     (void) (a4), 0)
26b6b52
+# define DUMMY_PROBE5(a1, a2, a3, a4, a5)			  \
26b6b52
+					do {} while ((void) (a1), \
26b6b52
+						     (void) (a2), \
26b6b52
+						     (void) (a3), \
26b6b52
+						     (void) (a4), \
26b6b52
+						     (void) (a5), 0)
26b6b52
+# define DUMMY_PROBE6(a1, a2, a3, a4, a5, a6)			  \
26b6b52
+					do {} while ((void) (a1), \
26b6b52
+						     (void) (a2), \
26b6b52
+						     (void) (a3), \
26b6b52
+						     (void) (a4), \
26b6b52
+						     (void) (a5), \
26b6b52
+						     (void) (a6), 0)
26b6b52
+# define DUMMY_PROBE7(a1, a2, a3, a4, a5, a6, a7)		  \
26b6b52
+					do {} while ((void) (a1), \
26b6b52
+						     (void) (a2), \
26b6b52
+						     (void) (a3), \
26b6b52
+						     (void) (a4), \
26b6b52
+						     (void) (a5), \
26b6b52
+						     (void) (a6), \
26b6b52
+						     (void) (a7), 0)
26b6b52
+# define DUMMY_PROBE8(a1, a2, a3, a4, a5, a6, a7, a8)		  \
26b6b52
+					do {} while ((void) (a1), \
26b6b52
+						     (void) (a2), \
26b6b52
+						     (void) (a3), \
26b6b52
+						     (void) (a4), \
26b6b52
+						     (void) (a5), \
26b6b52
+						     (void) (a6), \
26b6b52
+						     (void) (a7), \
26b6b52
+						     (void) (a8), 0)
26b6b52
+# define DUMMY_PROBE9(a1, a2, a3, a4, a5, a6, a7, a8, a9)	  \
26b6b52
+					do {} while ((void) (a1), \
26b6b52
+						     (void) (a2), \
26b6b52
+						     (void) (a3), \
26b6b52
+						     (void) (a4), \
26b6b52
+						     (void) (a5), \
26b6b52
+						     (void) (a6), \
26b6b52
+						     (void) (a7), \
26b6b52
+						     (void) (a8), \
26b6b52
+						     (void) (a9), 0)
26b6b52
+# define DUMMY_PROBE10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)	  \
26b6b52
+					do {} while ((void) (a1), \
26b6b52
+						     (void) (a2), \
26b6b52
+						     (void) (a3), \
26b6b52
+						     (void) (a4), \
26b6b52
+						     (void) (a5), \
26b6b52
+						     (void) (a6), \
26b6b52
+						     (void) (a7), \
26b6b52
+						     (void) (a8), \
26b6b52
+						     (void) (a9), \
26b6b52
+						     (void) (a10), 0)
26b6b52
+
26b6b52
+#endif	/* USE_STAP_PROBE.  */
26b6b52
+
26b6b52
+#endif	/* stap-probe.h */
26b6b52
diff -Nrup a/config.h.in b/config.h.in
26b6b52
--- a/config.h.in	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/config.h.in	2012-01-01 20:41:26.632439843 -0700
26b6b52
@@ -187,6 +187,9 @@
26b6b52
 /* Define if `.ctors' and `.dtors' sections shouldn't be used.  */
26b6b52
 #undef	NO_CTORS_DTORS_SECTIONS
26b6b52
 
26b6b52
+/* Define if Systemtap <sys/sdt.h> probes should be defined.  */
26b6b52
+#undef USE_STAP_PROBE
26b6b52
+
26b6b52
 /*
26b6b52
  */
26b6b52
 
26b6b52
diff -Nrup a/configure b/configure
26b6b52
--- a/configure	2012-01-01 20:40:50.423446105 -0700
26b6b52
+++ b/configure	2012-01-01 20:41:26.634439843 -0700
26b6b52
@@ -791,6 +791,7 @@ enable_kernel
26b6b52
 enable_all_warnings
26b6b52
 enable_multi_arch
26b6b52
 enable_nss_crypt
26b6b52
+enable_systemtap
26b6b52
 with_cpu
26b6b52
 '
26b6b52
       ac_precious_vars='build_alias
26b6b52
@@ -1450,6 +1451,7 @@ Optional Features:
26b6b52
   --enable-multi-arch     enable single DSO with optimizations for multiple
26b6b52
                           architectures
26b6b52
   --enable-nss-crypt      enable libcrypt to use nss
26b6b52
+  --enable-systemtap      enable systemtap static probe points [default=no]
26b6b52
 
26b6b52
 Optional Packages:
26b6b52
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
26b6b52
@@ -3804,6 +3806,51 @@ else
26b6b52
 fi
26b6b52
 
26b6b52
 
26b6b52
+# Check whether --enable-systemtap was given.
26b6b52
+if test "${enable_systemtap+set}" = set; then :
26b6b52
+  enableval=$enable_systemtap; systemtap=$enableval
26b6b52
+else
26b6b52
+  systemtap=no
26b6b52
+fi
26b6b52
+
26b6b52
+if test x$systemtap != xno; then
26b6b52
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemtap static probe support" >&5
26b6b52
+$as_echo_n "checking for systemtap static probe support... " >&6; }
26b6b52
+if test "${libc_cv_sdt+set}" = set; then :
26b6b52
+  $as_echo_n "(cached) " >&6
26b6b52
+else
26b6b52
+    old_CFLAGS="$CFLAGS"
26b6b52
+  CFLAGS="-std=gnu99 $CFLAGS"
26b6b52
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
26b6b52
+/* end confdefs.h.  */
26b6b52
+#include <sys/sdt.h>
26b6b52
+void foo (int i, void *p)
26b6b52
+{
26b6b52
+  asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
26b6b52
+       :: STAP_PROBE_ASM_OPERANDS (2, i, p));
26b6b52
+}
26b6b52
+_ACEOF
26b6b52
+if ac_fn_c_try_compile "$LINENO"; then :
26b6b52
+  libc_cv_sdt=yes
26b6b52
+else
26b6b52
+  libc_cv_sdt=no
26b6b52
+fi
26b6b52
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
26b6b52
+  CFLAGS="$old_CFLAGS"
26b6b52
+fi
26b6b52
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sdt" >&5
26b6b52
+$as_echo "$libc_cv_sdt" >&6; }
26b6b52
+  if test $libc_cv_sdt = yes; then
26b6b52
+    $as_echo "#define USE_STAP_PROBE 1" >>confdefs.h
26b6b52
+
26b6b52
+  else
26b6b52
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
26b6b52
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
26b6b52
+as_fn_error $? "systemtap support needs sys/sdt.h with asm support
26b6b52
+See \`config.log' for more details" "$LINENO" 5; }
26b6b52
+  fi
26b6b52
+fi
26b6b52
+
26b6b52
 # The way shlib-versions is used to generate soversions.mk uses a
26b6b52
 # fairly simplistic model for name recognition that can't distinguish
26b6b52
 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
26b6b52
diff -Nrup a/configure.in b/configure.in
26b6b52
--- a/configure.in	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/configure.in	2012-01-01 20:41:26.635439843 -0700
26b6b52
@@ -290,6 +290,29 @@ else
26b6b52
 fi
26b6b52
 AC_SUBST(libc_cv_nss_crypt)
26b6b52
 
26b6b52
+AC_ARG_ENABLE([systemtap],
26b6b52
+              [AS_HELP_STRING([--enable-systemtap],
26b6b52
+	       [enable systemtap static probe points @<:@default=no@:>@])],
26b6b52
+              [systemtap=$enableval],
26b6b52
+	      [systemtap=no])
26b6b52
+if test x$systemtap != xno; then
26b6b52
+  AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
26b6b52
+  old_CFLAGS="$CFLAGS"
26b6b52
+  CFLAGS="-std=gnu99 $CFLAGS"
26b6b52
+  AC_COMPILE_IFELSE([#include <sys/sdt.h>
26b6b52
+void foo (int i, void *p)
26b6b52
+{
26b6b52
+  asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
26b6b52
+       :: STAP_PROBE_ASM_OPERANDS (2, i, p));
26b6b52
+}], [libc_cv_sdt=yes], [libc_cv_sdt=no])
26b6b52
+  CFLAGS="$old_CFLAGS"])
26b6b52
+  if test $libc_cv_sdt = yes; then
26b6b52
+    AC_DEFINE([USE_STAP_PROBE])
26b6b52
+  else
26b6b52
+    AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
26b6b52
+  fi
26b6b52
+fi
26b6b52
+
26b6b52
 # The way shlib-versions is used to generate soversions.mk uses a
26b6b52
 # fairly simplistic model for name recognition that can't distinguish
26b6b52
 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
26b6b52
diff -Nrup a/extra-lib.mk b/extra-lib.mk
26b6b52
--- a/extra-lib.mk	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/extra-lib.mk	2012-01-01 20:41:26.644439841 -0700
26b6b52
@@ -101,4 +101,4 @@ ifneq (,$(cpp-srcs-left))
26b6b52
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
26b6b52
 endif
26b6b52
 
26b6b52
-CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1
26b6b52
+CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1 -DIN_LIB=$(lib)
26b6b52
diff -Nrup a/elf/Makefile b/elf/Makefile
26b6b52
--- a/elf/Makefile	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/elf/Makefile	2012-01-01 20:41:26.637439843 -0700
26b6b52
@@ -505,7 +506,8 @@ CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'
26b6b52
 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
26b6b52
 CFLAGS-cache.c = $(SYSCONF-FLAGS)
26b6b52
 
26b6b52
-CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
26b6b52
+CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
26b6b52
+		     -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
26b6b52
 
26b6b52
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
26b6b52
 generated += $(addsuffix .so,$(strip $(modules-names)))
26b6b52
diff -Nrup a/elf/rtld-Rules b/elf/rtld-Rules
26b6b52
--- a/elf/rtld-Rules	2012-01-01 05:16:32.000000000 -0700
26b6b52
+++ b/elf/rtld-Rules	2012-01-01 20:41:26.642439841 -0700
26b6b52
@@ -1,7 +1,7 @@
26b6b52
 # Subroutine makefile for compiling libc modules linked into dynamic linker.
26b6b52
 
26b6b52
 # Copyright (C) 2002,2003,2005,2006,2008,2010,2011
26b6b52
-#   Free Software Foundation, Inc.
26b6b52
+#	Free Software Foundation, Inc.
26b6b52
 # This file is part of the GNU C Library.
26b6b52
 
26b6b52
 # The GNU C Library is free software; you can redistribute it and/or
26b6b52
@@ -131,6 +131,6 @@ ifdef rtld-depfiles
26b6b52
 endif
26b6b52
 
26b6b52
 # This here is the whole point of all the shenanigans.
26b6b52
-rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1
26b6b52
+rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld
26b6b52
 
26b6b52
 endif