This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Apply i386/profil-counter.h changes to arm, sh and x86_64 too


Hi!

These 3 arches apparently use some struct instead of struct * as argument to
profil_counter, thus might see the same problem. Am not exactly sure whether
all of the arches support sibcall already, at least x86_64 doesn't yet but
probably will do soon, but it is better to do this now IMHO than to forget
about it.

2002-10-13  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter):
	Add hack to prevent the compiler from clobbering the signal context.
	* sysdeps/unix/sysv/linux/sh/profil-counter.h (profil_counter):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/profil-counter.h (profil_counter):
	Likewise.

--- libc/sysdeps/unix/sysv/linux/sh/profil-counter.h.jj	2001-08-23 18:51:29.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/sh/profil-counter.h	2002-10-13 22:03:51.000000000 +0200
@@ -1,5 +1,5 @@
 /* Low-level statistical profiling support function.  Linux/SH version.
-   Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,4 +25,9 @@ profil_counter (int signo, int _a2, int 
   void *pc;
   pc = (void *) sc.sc_pc;
   profil_count (pc);
+
+  /* This is a hack to prevent the compiler from implementing the
+     above function call as a sibcall.  The sibcall would overwrite
+     the signal context.  */
+  asm volatile ("");
 }
--- libc/sysdeps/unix/sysv/linux/arm/profil-counter.h.jj	2001-08-23 18:50:48.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/arm/profil-counter.h	2002-10-13 22:02:09.000000000 +0200
@@ -1,5 +1,5 @@
 /* Low-level statistical profiling support function.  Linux/ARM version.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,4 +29,9 @@ profil_counter (int signo, int _a2, int 
   else
     pc = (void *) sc.v21.arm_pc;
   profil_count (pc);
+
+  /* This is a hack to prevent the compiler from implementing the
+     above function call as a sibcall.  The sibcall would overwrite
+     the signal context.  */
+  asm volatile ("");
 }
--- libc/sysdeps/unix/sysv/linux/x86_64/profil-counter.h.jj	2001-09-19 12:32:01.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/x86_64/profil-counter.h	2002-10-13 22:05:17.000000000 +0200
@@ -1,5 +1,5 @@
 /* Low-level statistical profiling support function.  Linux/x86-64 version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,4 +24,9 @@ static void
 profil_counter (int signo, SIGCONTEXT scp)
 {
   profil_count ((void *) GET_PC (scp));
+
+  /* This is a hack to prevent the compiler from implementing the
+     above function call as a sibcall.  The sibcall would overwrite
+     the signal context.  */
+  asm volatile ("");
 }

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]