2006-01-07 Carlos O'Donell <carlos@systemhalted.org>

* sysdeps/hppa/elf/start.S (_start): Use PLABEL32 relocations
	by using LR and RR. Add %sr0 to iitlbp.
This commit is contained in:
Roland McGrath 2006-01-10 07:54:47 +00:00
parent 3e1470fba7
commit 96007fb015
1 changed files with 47 additions and 23 deletions

View File

@ -34,16 +34,27 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */ 02111-1307 USA. */
.text
.align 4
.import main, code .import main, code
.import $global$, data .import $global$, data
.import __libc_start_main, code .import __libc_start_main, code
.import __libc_csu_fini, code .import __libc_csu_fini, code
.import __libc_csu_init, code .import __libc_csu_init, code
/* Have the linker create plabel words
so we get PLABEL32 relocs and not 21/14 */
.section .rodata
.align 4
.Lpmain:
.word P%main
.Lp__libc_start_main:
.word P%__libc_start_main
.Lp__libc_csu_fini:
.word P%__libc_csu_fini
.Lp__libc_csu_init:
.word P%__libc_csu_init
.text
.align 4
.globl _start .globl _start
.export _start, ENTRY .export _start, ENTRY
.type _start,@function .type _start,@function
@ -52,28 +63,41 @@ _start:
.proc .proc
.callinfo .callinfo
/* load main */
ldil LP%main, %r26
ldo RP%main(%r26), %r26
/* argc and argv should be in 25 and 24 */
/* Expand the stack to store the 5th through 7th args */ /* Expand the stack to store the 5th through 7th args */
ldo 64(%sp), %sp ldo 64(%sp), %sp
/* TODO: Follow ABI? Place more things on the stack here... */
/* void (*rtld_fini) (void) (actually the 6th arg) */ #if SHARED
stw %r23, -56(%sp) /* load main (1st argument) */
addil LR'.Lpmain, %r19
/* void (*init) (void) */ ldw RR'.Lpmain(%r1), %r26
ldil LP%__libc_csu_init, %r23 ldw 0(%r26),%r26
ldo RP%__libc_csu_init(%r23), %r23 /* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
/* void (*init) (void) (4th argument) */
/* void (*fini) (void) */ addil LR'.Lp__libc_csu_init, %r19
ldil LP%__libc_csu_fini, %r22 ldw RR'.Lp__libc_csu_init(%r1), %r23
ldo RP%__libc_csu_fini(%r22), %r22 ldw 0(%r23), %r23
/* void (*fini) (void) (5th argument) */
addil LR'.Lp__libc_csu_fini, %r19
ldw RR'.Lp__libc_csu_fini(%r1), %r22
ldw 0(%r22), %r22
#else
/* load main (1st argument) */
ldil LR'.Lpmain, %r26
ldw RR'.Lpmain(%r26), %r26
/* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
/* void (*init) (void) (4th argument) */
ldil LR'.Lp__libc_csu_init, %r23
ldw RR'.Lp__libc_csu_init(%r23), %r23
/* void (*fini) (void) (5th argument) */
ldil LR'.Lp__libc_csu_fini, %r22
ldw RR'.Lp__libc_csu_fini(%r22), %r22
#endif
/* Store 5th argument */
stw %r22, -52(%sp) stw %r22, -52(%sp)
/* void (*rtld_fini) (void) (6th argument) */
/* void *stack_end */ stw %r23, -56(%sp)
/* void *stack_end (7th argument) */
stw %sp, -60(%sp) stw %sp, -60(%sp)
/* load global */ /* load global */
@ -83,7 +107,7 @@ _start:
bl __libc_start_main,%r2 bl __libc_start_main,%r2
nop nop
/* die horribly if it returned (it shouldn't) */ /* die horribly if it returned (it shouldn't) */
iitlbp %r0,(%r0) iitlbp %r0,(%sr0,%r0)
nop nop
.procend .procend