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


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

Re: A testcase anad a patch for the __gmon_start__ problem on PPC.


On Thu, 12 Oct 2000, Franz Sirl wrote:
> At 22:45 11.10.00, Geoff Keating wrote:
> >OK, this is slightly wrong.  The right test would be that the first
> >instruction at __gmon_start__ is 'bl,a 0'.
>
> Yes, either that or 'addi r11,r0,xxxx' for lazy relocation (as HJ noted).
> The test for 0 actually was meant as a shortcut to avoid doing 2 compares,
> but this cannot work when  gmon_start points to a PLT entry and not the
> real function as I thought. I'll do a real patch and test it.

Here is the patch, it works fine for me after recompiling the affected libs 
against the new crt*.o files.

Franz.

	* sysdeps/generic/initfini.c (GMON_START_COMPAT): New macro.
	(call_gmon_start): Use it.
	* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Add fcntl and fcntl64.

Index: sysdeps/generic/initfini.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/initfini.c,v
retrieving revision 1.4
diff -u -p -r1.4 initfini.c
--- sysdeps/generic/initfini.c	2000/09/10 08:11:37	1.4
+++ sysdeps/generic/initfini.c	2000/10/12 19:52:25
@@ -61,13 +61,20 @@ asm ("\n/*@TESTS_END*/");
 /* The beginning of _init:  */
 asm ("\n/*@_init_PROLOG_BEGINS*/");
 
+#ifdef __powerpc__
+#define GMON_START_COMPAT(a) (*(unsigned int *) (a) != 0x48000002 \
+                              && ((*(unsigned int *) (a)) >> 16) != 0x3960)
+#else
+#define GMON_START_COMPAT(a) 1
+#endif
+
 static void
 call_gmon_start(void)
 {
   extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
   void (*gmon_start) (void) = __gmon_start__;
 
-  if (gmon_start)
+  if (gmon_start && GMON_START_COMPAT (gmon_start))
     gmon_start ();  
 }
 
Index: sysdeps/unix/sysv/linux/powerpc/syscalls.list
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/powerpc/syscalls.list,v
retrieving revision 1.24
diff -u -p -r1.24 syscalls.list
--- sysdeps/unix/sysv/linux/powerpc/syscalls.list	2000/08/27 03:26:34	1.24
+++ sysdeps/unix/sysv/linux/powerpc/syscalls.list	2000/10/12 19:52:34
@@ -12,6 +12,8 @@ rt_sigprocmask	-	rt_sigprocmask	i:ippi	_
 rt_sigqueueinfo	-	rt_sigqueueinfo	i:iip	__syscall_rt_sigqueueinfo
 rt_sigsuspend	-	rt_sigsuspend	i:pi	__syscall_rt_sigsuspend
 rt_sigtimedwait	-	rt_sigtimedwait	i:pppi	__syscall_rt_sigtimedwait
+s_fcntl		fcntl	fcntl		i:iiF	__syscall_fcntl
+s_fcntl64	fcntl64	fcntl64		i:iiF	__syscall_fcntl64
 s_fstat64	fxstat64 fstat64	i:ip	__syscall_fstat64
 s_ftruncate64	ftruncate64 ftruncate64	i:iii	__syscall_ftruncate64
 s_getcwd	getcwd	getcwd		i:pi	__syscall_getcwd

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