mirror of git://sourceware.org/git/glibc.git
2006-09-13 Carlos O'Donell <carlos@systemhalted.org>
* sysdeps/hppa/dl-machine.h (RTLD_START): Comment the use of _dl_fini_plabel. * sysdeps/hppa/elf/start.S: Correctly pass r23 to argument 6 of __libc_start_main. Comment the order of arguments at entry and those to __libc_start_main.
This commit is contained in:
parent
0daa050021
commit
2625a1fb08
|
@ -447,8 +447,10 @@ asm ( \
|
||||||
" ldw -40(%sp),%r25\n" \
|
" ldw -40(%sp),%r25\n" \
|
||||||
" ldw -44(%sp),%r24\n" \
|
" ldw -44(%sp),%r24\n" \
|
||||||
\
|
\
|
||||||
/* _dl_fini does have a PLT slot now. I don't know how to get \
|
/* _dl_fini is a local function in the loader, so we construct \
|
||||||
to it though, so this hack will remain. */ \
|
a false OPD here and pass this to the application. */ \
|
||||||
|
/* FIXME: Should be able to use P%, and LR RR to have the \
|
||||||
|
the linker construct a proper OPD. */ \
|
||||||
" .section .data\n" \
|
" .section .data\n" \
|
||||||
"__dl_fini_plabel:\n" \
|
"__dl_fini_plabel:\n" \
|
||||||
" .word _dl_fini\n" \
|
" .word _dl_fini\n" \
|
||||||
|
|
|
@ -40,8 +40,9 @@
|
||||||
.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
|
/* Have the linker create plabel words so we get PLABEL32
|
||||||
so we get PLABEL32 relocs and not 21/14 */
|
relocs and not 21/14. The use of 21/14 relocs is only
|
||||||
|
supported in the latest dynamic linker. */
|
||||||
.section .rodata
|
.section .rodata
|
||||||
.align 4
|
.align 4
|
||||||
.Lpmain:
|
.Lpmain:
|
||||||
|
@ -59,20 +60,45 @@
|
||||||
.export _start, ENTRY
|
.export _start, ENTRY
|
||||||
.type _start,@function
|
.type _start,@function
|
||||||
_start:
|
_start:
|
||||||
|
/* At entry to the function we have:
|
||||||
|
|
||||||
|
r26 - Unused
|
||||||
|
r25 - argc
|
||||||
|
r24 - argv
|
||||||
|
r23 - False _dl_fini plabel address
|
||||||
|
|
||||||
|
This function is called from the lower half of RTLD_START.
|
||||||
|
|
||||||
|
The call to __libc_start_main expects:
|
||||||
|
|
||||||
|
1. r26 - Application main
|
||||||
|
2. r25 - argc
|
||||||
|
3. r24 - argv
|
||||||
|
4. r23 - __libc_csu_init
|
||||||
|
5. sp-52 - __libc_csu_fini
|
||||||
|
6. sp-56 - rtld_fini
|
||||||
|
7. sp-60 - stackend */
|
||||||
|
|
||||||
.proc
|
.proc
|
||||||
.callinfo
|
.callinfo
|
||||||
|
/* Clear previous-sp. */
|
||||||
/* Expand the stack to store the 5th through 7th args */
|
stw %r0, -4(%sp)
|
||||||
|
/* Setup the stack and frame. */
|
||||||
|
stw %rp, -20(%sp)
|
||||||
ldo 64(%sp), %sp
|
ldo 64(%sp), %sp
|
||||||
/* TODO: Follow ABI? Place more things on the stack here... */
|
stw %sp, -4(%sp)
|
||||||
|
stw %r19, -32(%sp)
|
||||||
|
|
||||||
|
/* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
|
||||||
|
/* void (*rtld_fini) (void) (6th argument) */
|
||||||
|
stw %r23, -56(%sp)
|
||||||
|
/* Need to setup 1, 4, 5, and 7th arguments */
|
||||||
|
|
||||||
#if SHARED
|
#if SHARED
|
||||||
/* load main (1st argument) */
|
/* load main (1st argument) */
|
||||||
addil LR'.Lpmain, %r19
|
addil LR'.Lpmain, %r19
|
||||||
ldw RR'.Lpmain(%r1), %r26
|
ldw RR'.Lpmain(%r1), %r26
|
||||||
ldw 0(%r26),%r26
|
ldw 0(%r26),%r26
|
||||||
/* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
|
|
||||||
/* void (*init) (void) (4th argument) */
|
/* void (*init) (void) (4th argument) */
|
||||||
addil LR'.Lp__libc_csu_init, %r19
|
addil LR'.Lp__libc_csu_init, %r19
|
||||||
ldw RR'.Lp__libc_csu_init(%r1), %r23
|
ldw RR'.Lp__libc_csu_init(%r1), %r23
|
||||||
|
@ -85,7 +111,6 @@ _start:
|
||||||
/* load main (1st argument) */
|
/* load main (1st argument) */
|
||||||
ldil LR'.Lpmain, %r26
|
ldil LR'.Lpmain, %r26
|
||||||
ldw RR'.Lpmain(%r26), %r26
|
ldw RR'.Lpmain(%r26), %r26
|
||||||
/* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
|
|
||||||
/* void (*init) (void) (4th argument) */
|
/* void (*init) (void) (4th argument) */
|
||||||
ldil LR'.Lp__libc_csu_init, %r23
|
ldil LR'.Lp__libc_csu_init, %r23
|
||||||
ldw RR'.Lp__libc_csu_init(%r23), %r23
|
ldw RR'.Lp__libc_csu_init(%r23), %r23
|
||||||
|
@ -95,8 +120,6 @@ _start:
|
||||||
#endif
|
#endif
|
||||||
/* Store 5th argument */
|
/* Store 5th argument */
|
||||||
stw %r22, -52(%sp)
|
stw %r22, -52(%sp)
|
||||||
/* void (*rtld_fini) (void) (6th argument) */
|
|
||||||
stw %r23, -56(%sp)
|
|
||||||
/* void *stack_end (7th argument) */
|
/* void *stack_end (7th argument) */
|
||||||
stw %sp, -60(%sp)
|
stw %sp, -60(%sp)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue