This is the mail archive of the libc-alpha@sourceware.org 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]
Other format: [Raw text]

SH, S390: (not) calling __gmon_start__ from pt-initfini.c


Hello!

While working on a SH issue, I noticed the following oddity: (only) on SH
(as well as on S390-32 / 64), NPTL's pt-initfini.c has instructions for
calling __gmon_start__ -- which I think is wrong, as crti.o (initfini.c)
is doing that already.  Not doing that in pt-initfini.c is in line with
an old commit:

commit 7e9463020bc7ef69f66eb4bb27c1a1e065cdc90c
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Tue Apr 24 04:40:38 2001 +0000

    Update.
    
        * sysdeps/unix/sysv/linux/ia64/pt-initfini.c (_init): We don't
        have to call __gmon_start__ in the libpthread DSO.
        * sysdeps/pthread/pt-initfini.c (_init): Likewise.

It's been some time, and that change was in the LinuxThreads context, but
there's no reason that it shouldn't still be valid.


Here is a patch for SH; no regressions in the testsuite.

nptl/
2009-11-27  Thomas Schwinge  <thomas@codesourcery.com>

	* sysdeps/unix/sysv/linux/sh/pt-initfini.c (_init): Don't call
	__gmon_start__.

Index: nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c
===================================================================
--- nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c	(revision 9312)
+++ nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c	(working copy)
@@ -1,5 +1,5 @@
 /* Special .init and .fini section support for SH. NPTL version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it
@@ -62,19 +62,12 @@
 	mov.l	.L24,r1\n\
 	add	r0,r1\n\
 	jsr	@r1\n\
-	 nop\n\
-	mova	.L23,r0\n\
-	mov.l	.L23,r1\n\
-	add	r0,r1\n\
-	jsr	@r1\n\
 	 mov	r15,r14\n\
 	bra	1f\n\
 	 nop\n\
 	.align 2\n\
 .L22:\n\
 	.long	_GLOBAL_OFFSET_TABLE_\n\
-.L23:\n\
-	.long	__gmon_start__@PLT\n\
 .L24:\n\
 	.long	__pthread_initialize_minimal_internal@PLT\n\
 1:\n\
@@ -91,16 +84,6 @@
 	rts	\n\
 	mov.l	@r15+,r12\n\
 	END_INIT\n\
-	.section .text\n\
-	.align 5\n\
-	.weak	__gmon_start__\n\
-	.type	__gmon_start__,@function\n\
-__gmon_start__:\n\
-	mov.l	r14,@-r15\n\
-	mov	r15,r14\n\
-	mov	r14,r15\n\
-	rts	\n\
-	mov.l	@r15+,r14\n\
 	\n\
 /*@_init_EPILOG_ENDS*/\n\
 \n\


Here is an equivalent patch for S390, but this is COMPLETELY UNTESTED, so
maintainers please comment / test this.

nptl/
2009-11-27  Thomas Schwinge  <thomas@codesourcery.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c (_init): Don't
	call __gmon_start__.
	* sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c (_init): Likewise.


Index: nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c
===================================================================
--- nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c	(revision 9312)
+++ nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c	(working copy)
@@ -1,5 +1,5 @@
 /* Special .init and .fini section support for S/390.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it
@@ -67,8 +67,6 @@
 .LT1_0:\n\
 .LC13:\n\
 	.long	__pthread_initialize_minimal_internal-.LT1_0\n\
-.LC14:\n\
-	.long	__gmon_start__@GOT\n\
 .LC15:\n\
 	.long	_GLOBAL_OFFSET_TABLE_-.LT1_0\n\
 .LTN1_0:\n\
@@ -80,11 +78,6 @@
 	L     1,.LC13-.LT1_0(13)\n\
 	LA    1,0(1,13)\n\
 	BASR  14,1\n\
-	L     1,.LC14-.LT1_0(13)\n\
-	L     1,0(1,12)\n\
-	LTR   1,1\n\
-	JE    .L22\n\
-	BASR  14,1\n\
 .L22:\n\
 #APP\n\
 	.align 4,0x07\n\
Index: nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c
===================================================================
--- nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c	(revision 9312)
+++ nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c	(working copy)
@@ -1,5 +1,5 @@
 /* Special .init and .fini section support for 64 bit S/390.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it
@@ -68,11 +68,6 @@
 	STG	1,0(15)\n\
 	LARL	12,_GLOBAL_OFFSET_TABLE_\n\
 	BRASL	14,__pthread_initialize_minimal_internal\n\
-	LARL	1,__gmon_start__@GOTENT\n\
-	LG	1,0(1)\n\
-	LTGR	1,1\n\
-	JE	.L22\n\
-	BASR	14,1\n\
 .L22:\n\
 #APP\n\
 	.align 4,0x07\n\


Regards,
 Thomas

Attachment: pgp00000.pgp
Description: PGP signature


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