[parisc-linux-cvs] glibc amodra

amodra@one.net.au amodra@one.net.au
Mon, 30 Apr 2001 23:50:28 +0930


On Mon, Apr 30, 2001 at 08:06:35AM -0600, Alan Modra wrote:
> Modified files:
> 	.              : Tag: merge_GLIBC_CVS_20010424 ChangeLog 
> 	sysdeps/hppa/elf: Tag: merge_GLIBC_CVS_20010424 initfini.c 
> Added files:
> 	linuxthreads/sysdeps/unix/sysv/linux/hppa: Tag: 
> 	                                           merge_GLIBC_CVS_20010424 
> 	                                           pt-initfini.c 
> 
> Log message:
> * linuxthreads/sysdeps/unix/sysv/linux/hppa/pt-initfini.c: New.
> * sysdeps/hppa/elf/initfini.c (__gmon_start__): Remove function.
> Update comment re linker capabilities.  Provide correct section
> attributes for .PARISC.unwind.

Note that removing the __gmon_start__ weak definition here means
you must have 2001/04/30 binutils, from sources.redhat.com CVS
(mainline or 2.11 branch) or pehc CVS.  Since this change is on
a pehc glibc branch, that shouldn't inconvenience too many people.


Index: sysdeps/hppa/elf/initfini.c
===================================================================
RCS file: /home/cvs/parisc/glibc/sysdeps/hppa/elf/initfini.c,v
retrieving revision 1.5
diff -u -p -r1.5 initfini.c
--- initfini.c	2001/02/06 02:45:07	1.5
+++ initfini.c	2001/04/30 14:02:30
@@ -41,12 +41,10 @@
    and epilogues.  Therefore we write these in assembly to make sure
    they do the right thing.
 
-   Note that we cannot have a weak undefined __gmon_start__, because
-   that would require this to be PIC, and the linker is currently not
-   able to generate a proper procedure descriptor for _init.  Sad but
-   true.  Anyway, HPPA is one of those horrible architectures where
-   making the comparison and indirect call is quite expensive (see the
-   comment in sysdeps/generic/initfini.c). */
+   As of 2001/04/30, the linker handles a call to a weak undefined
+   symbol by branching to .+8, ie. to where the call would normally
+   return.  This trick means we don't have to first check that
+   __gmon_start__ is defined.  */
 
 __asm__ ("
 
@@ -55,6 +53,8 @@ __asm__ ("
 /*@HEADER_ENDS*/
 
 /*@_init_PROLOG_BEGINS*/
+        .weak   __gmon_start__
+
 	.section .init
 	.align 4
 	.globl _init
@@ -69,21 +69,7 @@ _init:
 /*@_init_PROLOG_ENDS*/
 
 /*@_init_EPILOG_BEGINS*/
-        .text
-        .align 4
-        .weak   __gmon_start__
-        .type    __gmon_start__,@function
-__gmon_start__:
-	.proc
-	.callinfo
-	.entry
-        bv,n %r0(%r2)
-	.exit
-	.procend
-
-/* Here is the tail end of _init.  We put __gmon_start before this so
-   that the assembler creates the .PARISC.unwind section for us, ie.
-   with the right attributes.  */
+/* Here is the tail end of _init.  */
 	.section .init
 	ldw	-84(%sp),%rp
 	copy	%r4,%r19
@@ -93,7 +79,7 @@ _end_init:
 
 /* Our very own unwind info, because the assembler can't handle
    functions split into two or more pieces.  */
-	.section .PARISC.unwind
+	.section .PARISC.unwind,\"a\",@progbits
 	.extern _init
 	.word	_init, _end_init
 	.byte	0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08
@@ -120,7 +106,7 @@ _fini:
 _end_fini:
 	ldwm	-64(%sp),%r4
 
-	.section .PARISC.unwind
+	.section .PARISC.unwind,\"a\",@progbits
 	.extern _fini
 	.word	_fini, _end_fini
 	.byte	0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08