2002-08-28  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/s390/s390-64/dl-machine.h: Avoid unescaped newlines in
	string constants.
	* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
	* sysdeps/arm/dl-machine.h: Likewise.
	* sysdeps/cris/dl-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/register-dump.h: Likewise.
	* sysdeps/unix/sysv/aix/gettimeofday.c: Likewise.
This commit is contained in:
Ulrich Drepper 2002-08-28 21:32:56 +00:00
parent 7f86dfcce9
commit 669ed63814
7 changed files with 392 additions and 381 deletions

View File

@ -1,3 +1,13 @@
2002-08-28 Ulrich Drepper <drepper@redhat.com>
* sysdeps/s390/s390-64/dl-machine.h: Avoid unescaped newlines in
string constants.
* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
* sysdeps/arm/dl-machine.h: Likewise.
* sysdeps/cris/dl-machine.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/register-dump.h: Likewise.
* sysdeps/unix/sysv/aix/gettimeofday.c: Likewise.
2002-08-28 Roland McGrath <roland@redhat.com> 2002-08-28 Roland McGrath <roland@redhat.com>
* Makeconfig (default_cflags): Revert unintended change. * Makeconfig (default_cflags): Revert unintended change.

View File

@ -126,14 +126,15 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
and then redirect to the address it returns. */ and then redirect to the address it returns. */
// macro for handling PIC situation.... // macro for handling PIC situation....
#ifdef PIC #ifdef PIC
#define CALL_ROUTINE(x) " ldr sl,0f #define CALL_ROUTINE(x) "\
add sl, pc, sl ldr sl,0f\n\
1: ldr r2, 2f add sl, pc, sl\n\
mov lr, pc 1: ldr r2, 2f\n\
add pc, sl, r2 mov lr, pc\n\
b 3f add pc, sl, r2\n\
0: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4 b 3f\n\
2: .word " #x "(GOTOFF) 0: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4\n\
2: .word " #x "(GOTOFF)\n\
3: " 3: "
#else #else
#define CALL_ROUTINE(x) " bl " #x #define CALL_ROUTINE(x) " bl " #x
@ -141,114 +142,114 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
#ifndef PROF #ifndef PROF
# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
.text .text\n\
.globl _dl_runtime_resolve .globl _dl_runtime_resolve\n\
.type _dl_runtime_resolve, #function .type _dl_runtime_resolve, #function\n\
.align 2 .align 2\n\
_dl_runtime_resolve: _dl_runtime_resolve:\n\
@ we get called with @ we get called with\n\
@ stack[0] contains the return address from this call @ stack[0] contains the return address from this call\n\
@ ip contains &GOT[n+3] (pointer to function) @ ip contains &GOT[n+3] (pointer to function)\n\
@ lr points to &GOT[2] @ lr points to &GOT[2]\n\
\n\
@ save almost everything; lr is already on the stack @ save almost everything; lr is already on the stack\n\
stmdb sp!,{r0-r3,sl,fp} stmdb sp!,{r0-r3,sl,fp}\n\
\n\
@ prepare to call fixup() @ prepare to call fixup()\n\
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
sub r1, ip, lr sub r1, ip, lr\n\
sub r1, r1, #4 sub r1, r1, #4\n\
add r1, r1, r1 add r1, r1, r1\n\
\n\
@ get pointer to linker struct @ get pointer to linker struct\n\
ldr r0, [lr, #-4] ldr r0, [lr, #-4]\n\
\n\
@ call fixup routine @ call fixup routine\n\
" CALL_ROUTINE(fixup) " " CALL_ROUTINE(fixup) "\n\
\n\
@ save the return @ save the return\n\
mov ip, r0 mov ip, r0\n\
\n\
@ restore the stack @ restore the stack\n\
ldmia sp!,{r0-r3,sl,fp,lr} ldmia sp!,{r0-r3,sl,fp,lr}\n\
\n\
@ jump to the newly found address @ jump to the newly found address\n\
mov pc, ip mov pc, ip\n\
\n\
.size _dl_runtime_resolve, .-_dl_runtime_resolve .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
\n\
.globl _dl_runtime_profile .globl _dl_runtime_profile\n\
.type _dl_runtime_profile, #function .type _dl_runtime_profile, #function\n\
.align 2 .align 2\n\
_dl_runtime_profile: _dl_runtime_profile:\n\
@ save almost everything; lr is already on the stack @ save almost everything; lr is already on the stack\n\
stmdb sp!,{r0-r3,sl,fp} stmdb sp!,{r0-r3,sl,fp}\n\
\n\
@ prepare to call fixup() @ prepare to call fixup()\n\
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
sub r1, ip, lr sub r1, ip, lr\n\
sub r1, r1, #4 sub r1, r1, #4\n\
add r1, r1, r1 add r1, r1, r1\n\
\n\
@ get pointer to linker struct @ get pointer to linker struct\n\
ldr r0, [lr, #-4] ldr r0, [lr, #-4]\n\
\n\
@ call profiling fixup routine @ call profiling fixup routine\n\
" CALL_ROUTINE(profile_fixup) " " CALL_ROUTINE(profile_fixup) "\n\
\n\
@ save the return @ save the return\n\
mov ip, r0 mov ip, r0\n\
\n\
@ restore the stack @ restore the stack\n\
ldmia sp!,{r0-r3,sl,fp,lr} ldmia sp!,{r0-r3,sl,fp,lr}\n\
\n\
@ jump to the newly found address @ jump to the newly found address\n\
mov pc, ip mov pc, ip\n\
\n\
.size _dl_runtime_resolve, .-_dl_runtime_resolve .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
.previous .previous\n\
"); ");
#else // PROF #else // PROF
# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
.text .text\n\
.globl _dl_runtime_resolve .globl _dl_runtime_resolve\n\
.globl _dl_runtime_profile .globl _dl_runtime_profile\n\
.type _dl_runtime_resolve, #function .type _dl_runtime_resolve, #function\n\
.type _dl_runtime_profile, #function .type _dl_runtime_profile, #function\n\
.align 2 .align 2\n\
_dl_runtime_resolve: _dl_runtime_resolve:\n\
_dl_runtime_profile: _dl_runtime_profile:\n\
@ we get called with @ we get called with\n\
@ stack[0] contains the return address from this call @ stack[0] contains the return address from this call\n\
@ ip contains &GOT[n+3] (pointer to function) @ ip contains &GOT[n+3] (pointer to function)\n\
@ lr points to &GOT[2] @ lr points to &GOT[2]\n\
\n\
@ save almost everything; return add is already on the stack @ save almost everything; return add is already on the stack\n\
stmdb sp!,{r0-r3,sl,fp} stmdb sp!,{r0-r3,sl,fp}\n\
\n\
@ prepare to call fixup() @ prepare to call fixup()\n\
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
sub r1, ip, lr sub r1, ip, lr\n\
sub r1, r1, #4 sub r1, r1, #4\n\
add r1, r1, r1 add r1, r1, r1\n\
\n\
@ get pointer to linker struct @ get pointer to linker struct\n\
ldr r0, [lr, #-4] ldr r0, [lr, #-4]\n\
\n\
@ call profiling fixup routine @ call profiling fixup routine\n\
" CALL_ROUTINE(fixup) " " CALL_ROUTINE(fixup) "\n\
\n\
@ save the return @ save the return\n\
mov ip, r0 mov ip, r0\n\
\n\
@ restore the stack @ restore the stack\n\
ldmia sp!,{r0-r3,sl,fp,lr} ldmia sp!,{r0-r3,sl,fp,lr}\n\
\n\
@ jump to the newly found address @ jump to the newly found address\n\
mov pc, ip mov pc, ip\n\
\n\
.size _dl_runtime_profile, .-_dl_runtime_profile .size _dl_runtime_profile, .-_dl_runtime_profile\n\
.previous .previous\n\
"); ");
#endif //PROF #endif //PROF
@ -261,70 +262,70 @@ _dl_runtime_profile:
its return value is the user program's entry point. */ its return value is the user program's entry point. */
#define RTLD_START asm ("\ #define RTLD_START asm ("\
.text .text\n\
.globl _start .globl _start\n\
.globl _dl_start_user .globl _dl_start_user\n\
_start: _start:\n\
@ at start time, all the args are on the stack @ at start time, all the args are on the stack\n\
mov r0, sp mov r0, sp\n\
bl _dl_start bl _dl_start\n\
@ returns user entry point in r0 @ returns user entry point in r0\n\
_dl_start_user: _dl_start_user:\n\
mov r6, r0 mov r6, r0\n\
@ we are PIC code, so get global offset table @ we are PIC code, so get global offset table\n\
ldr sl, .L_GET_GOT ldr sl, .L_GET_GOT\n\
add sl, pc, sl add sl, pc, sl\n\
.L_GOT_GOT: .L_GOT_GOT:\n\
@ Store the highest stack address @ Store the highest stack address\n\
ldr r1, .L_STACK_END ldr r1, .L_STACK_END\n\
ldr r1, [sl, r1] ldr r1, [sl, r1]\n\
str sp, [r1] str sp, [r1]\n\
@ See if we were run as a command with the executable file @ See if we were run as a command with the executable file\n\
@ name as an extra leading argument. @ name as an extra leading argument.\n\
ldr r4, .L_SKIP_ARGS ldr r4, .L_SKIP_ARGS\n\
ldr r4, [sl, r4] ldr r4, [sl, r4]\n\
@ get the original arg count @ get the original arg count\n\
ldr r1, [sp] ldr r1, [sp]\n\
@ subtract _dl_skip_args from it @ subtract _dl_skip_args from it\n\
sub r1, r1, r4 sub r1, r1, r4\n\
@ adjust the stack pointer to skip them @ adjust the stack pointer to skip them\n\
add sp, sp, r4, lsl #2 add sp, sp, r4, lsl #2\n\
@ get the argv address @ get the argv address\n\
add r2, sp, #4 add r2, sp, #4\n\
@ store the new argc in the new stack location @ store the new argc in the new stack location\n\
str r1, [sp] str r1, [sp]\n\
@ compute envp @ compute envp\n\
add r3, r2, r1, lsl #2 add r3, r2, r1, lsl #2\n\
add r3, r3, #4 add r3, r3, #4\n\
\n\
@ now we call _dl_init @ now we call _dl_init\n\
ldr r0, .L_LOADED ldr r0, .L_LOADED\n\
ldr r0, [sl, r0] ldr r0, [sl, r0]\n\
ldr r0, [r0] ldr r0, [r0]\n\
@ call _dl_init @ call _dl_init\n\
bl _dl_init_internal(PLT) bl _dl_init_internal(PLT)\n\
@ clear the startup flag @ clear the startup flag\n\
ldr r2, .L_STARTUP_FLAG ldr r2, .L_STARTUP_FLAG\n\
ldr r1, [sl, r2] ldr r1, [sl, r2]\n\
mov r0, #0 mov r0, #0\n\
str r0, [r1] str r0, [r1]\n\
@ load the finalizer function @ load the finalizer function\n\
ldr r0, .L_FINI_PROC ldr r0, .L_FINI_PROC\n\
ldr r0, [sl, r0] ldr r0, [sl, r0]\n\
@ jump to the user_s entry point @ jump to the user_s entry point\n\
mov pc, r6 mov pc, r6\n\
.L_GET_GOT: .L_GET_GOT:\n\
.word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4 \n\ .word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n\
.L_SKIP_ARGS: \n\ .L_SKIP_ARGS:\n\
.word _dl_skip_args(GOTOFF) \n\ .word _dl_skip_args(GOTOFF)\n\
.L_STARTUP_FLAG: .L_STARTUP_FLAG:\n\
.word _dl_starting_up(GOT) .word _dl_starting_up(GOT)\n\
.L_FINI_PROC: .L_FINI_PROC:\n\
.word _dl_fini(GOT) .word _dl_fini(GOT)\n\
.L_STACK_END: .L_STACK_END:\n\
.word __libc_stack_end(GOT) .word __libc_stack_end(GOT)\n\
.L_LOADED: .L_LOADED:\n\
.word _rtld_local(GOT) .word _rtld_local(GOT)\n\
.previous\n\ .previous\n\
"); ");

View File

@ -129,27 +129,27 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
and the link map in MOF. */ and the link map in MOF. */
#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \ #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
"; Trampoline for " #fixup_name " "; Trampoline for " #fixup_name "\n\
.globl " #tramp_name " .globl " #tramp_name "\n\
.type " #tramp_name ", @function .type " #tramp_name ", @function\n\
" #tramp_name ": " #tramp_name ":\n\
push $r13 push $r13\n\
push $r12 push $r12\n\
push $r11 push $r11\n\
push $r10 push $r10\n\
push $r9 push $r9\n\
push $srp push $srp\n\
move.d [$sp+6*4],$r11 move.d [$sp+6*4],$r11\n\
move $mof,$r10 move $mof,$r10\n\
" CALL_FN (fixup_name) " " CALL_FN (fixup_name) "\n\
move.d $r10,[$sp+6*4] move.d $r10,[$sp+6*4]\n\
pop $srp pop $srp\n\
pop $r9 pop $r9\n\
pop $r10 pop $r10\n\
pop $r11 pop $r11\n\
pop $r12 pop $r12\n\
pop $r13 pop $r13\n\
jump [$sp+] jump [$sp+]\n\
.size " #tramp_name ", . - " #tramp_name "\n" .size " #tramp_name ", . - " #tramp_name "\n"
#ifndef PROF #ifndef PROF
#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ #define ELF_MACHINE_RUNTIME_TRAMPOLINE \
@ -172,60 +172,60 @@ asm (TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup) \
its return value is the user program's entry point. */ its return value is the user program's entry point. */
#define RTLD_START asm ("\ #define RTLD_START asm ("\
.text .text\n\
.globl _start .globl _start\n\
.type _start,@function .type _start,@function\n\
_start: _start:\n\
move.d $sp,$r10 move.d $sp,$r10\n\
" CALL_FN (_dl_start) " " CALL_FN (_dl_start) "\n\
/* FALLTHRU */ /* FALLTHRU */\n\
\n\
.globl _dl_start_user .globl _dl_start_user\n\
.type _dl_start_user,@function .type _dl_start_user,@function\n\
_dl_start_user: _dl_start_user:\n\
; Save the user entry point address in R1. ; Save the user entry point address in R1.\n\
move.d $r10,$r1 move.d $r10,$r1\n\
; Point R0 at the GOT. ; Point R0 at the GOT.\n\
move.d $pc,$r0 move.d $pc,$r0\n\
sub.d .:GOTOFF,$r0 sub.d .:GOTOFF,$r0\n\
; Remember the highest stack address. ; Remember the highest stack address.\n\
move.d [$r0+__libc_stack_end:GOT16],$r13 move.d [$r0+__libc_stack_end:GOT16],$r13\n\
move.d $sp,[$r13] move.d $sp,[$r13]\n\
; See if we were run as a command with the executable file ; See if we were run as a command with the executable file\n\
; name as an extra leading argument. ; name as an extra leading argument.\n\
move.d [$r0+_dl_skip_args:GOT16],$r13 move.d [$r0+_dl_skip_args:GOT16],$r13\n\
move.d [$r13],$r9 move.d [$r13],$r9\n\
; Get the original argument count ; Get the original argument count\n\
move.d [$sp],$r11 move.d [$sp],$r11\n\
; Subtract _dl_skip_args from it. ; Subtract _dl_skip_args from it.\n\
sub.d $r9,$r11 sub.d $r9,$r11\n\
; Adjust the stack pointer to skip _dl_skip_args words. ; Adjust the stack pointer to skip _dl_skip_args words.\n\
addi $r9.d,$sp addi $r9.d,$sp\n\
; Put the new argc in place as expected by the user entry. ; Put the new argc in place as expected by the user entry.\n\
move.d $r11,[$sp] move.d $r11,[$sp]\n\
; Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) ; Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
; env: skip scaled argc and skip stored argc and NULL at end of argv[]. ; env: skip scaled argc and skip stored argc and NULL at end of argv[].\n\
move.d $sp,$r13 move.d $sp,$r13\n\
addi $r11.d,$r13 addi $r11.d,$r13\n\
addq 8,$r13 addq 8,$r13\n\
; argv: skip stored argc. ; argv: skip stored argc.\n\
move.d $sp,$r12 move.d $sp,$r12\n\
addq 4,$r12 addq 4,$r12\n\
; main_map: at _dl_loaded. ; main_map: at _dl_loaded.\n\
move.d [$r0+_rtld_local:GOT16],$r9 move.d [$r0+_rtld_local:GOT16],$r9\n\
move.d [$r9],$r10 move.d [$r9],$r10\n\
move.d _dl_init_internal:PLTG,$r9 move.d _dl_init_internal:PLTG,$r9\n\
add.d $r0,$r9 add.d $r0,$r9\n\
jsr $r9 jsr $r9\n\
; Pass our finalizer function to the user in R10. ; Pass our finalizer function to the user in R10.\n\
move.d [$r0+_dl_fini:GOT16],$r10 move.d [$r0+_dl_fini:GOT16],$r10\n\
; Terminate the frame-pointer. ; Terminate the frame-pointer.\n\
moveq 0,$r8 moveq 0,$r8\n\
; Cause SEGV if user entry returns. ; Cause SEGV if user entry returns.\n\
move $r8,$srp move $r8,$srp\n\
; Jump to the user's entry point. ; Jump to the user's entry point.\n\
jump $r1 jump $r1\n\
.size _dl_start_user, . - _dl_start_user .size _dl_start_user, . - _dl_start_user\n\
.previous"); .previous");
/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so

View File

@ -148,7 +148,7 @@ _dl_runtime_resolve:\n\
stg 0,0(15)\n\ stg 0,0(15)\n\
# load args saved by PLT\n\ # load args saved by PLT\n\
lmg 2,3,208(15)\n\ lmg 2,3,208(15)\n\
brasl 14,fixup # call fixup brasl 14,fixup # call fixup\n\
lgr 1,2 # function addr returned in r2\n\ lgr 1,2 # function addr returned in r2\n\
# restore registers\n\ # restore registers\n\
aghi 15,160\n\ aghi 15,160\n\
@ -236,12 +236,12 @@ _dl_start_user:\n\
# Point %r12 at the GOT.\n\ # Point %r12 at the GOT.\n\
larl %r12,_GLOBAL_OFFSET_TABLE_\n\ larl %r12,_GLOBAL_OFFSET_TABLE_\n\
# Store the highest stack address\n\ # Store the highest stack address\n\
lghi %r1,__libc_stack_end@GOT lghi %r1,__libc_stack_end@GOT\n\
lg %r1,0(%r1,%r12)\n\ lg %r1,0(%r1,%r12)\n\
stg %r15, 0(%r1)\n\ stg %r15, 0(%r1)\n\
# See if we were run as a command with the executable file\n\ # See if we were run as a command with the executable file\n\
# name as an extra leading argument.\n\ # name as an extra leading argument.\n\
lghi %r1,_dl_skip_args@GOT lghi %r1,_dl_skip_args@GOT\n\
lg %r1,0(%r1,%r12)\n\ lg %r1,0(%r1,%r12)\n\
lgf %r1,0(%r1) # load _dl_skip_args\n\ lgf %r1,0(%r1) # load _dl_skip_args\n\
# Get the original argument count.\n\ # Get the original argument count.\n\
@ -262,7 +262,7 @@ _dl_start_user:\n\
# Call the function to run the initializers.\n\ # Call the function to run the initializers.\n\
# Load the parameters:\n\ # Load the parameters:\n\
# (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\ # (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\
lghi %r2,_rtld_local@GOT lghi %r2,_rtld_local@GOT\n\
lg %r2,0(%r2,%r12)\n\ lg %r2,0(%r2,%r12)\n\
lg %r2,0(%r2)\n\ lg %r2,0(%r2)\n\
lg %r3,160(%r15)\n\ lg %r3,160(%r15)\n\
@ -270,9 +270,9 @@ _dl_start_user:\n\
lgr %r5,%r3\n\ lgr %r5,%r3\n\
sllg %r5,%r5,3\n\ sllg %r5,%r5,3\n\
la %r5,176(%r5,%r15)\n\ la %r5,176(%r5,%r15)\n\
brasl %r14,_dl_init_internal@PLT\n brasl %r14,_dl_init_internal@PLT\n\
# Pass our finalizer function to the user in %r14, as per ELF ABI.\n\ # Pass our finalizer function to the user in %r14, as per ELF ABI.\n\
lghi %r14,_dl_fini@GOT lghi %r14,_dl_fini@GOT\n\
lg %r14,0(%r14,%r12)\n\ lg %r14,0(%r14,%r12)\n\
# Free stack frame\n\ # Free stack frame\n\
aghi %r15,160\n\ aghi %r15,160\n\

View File

@ -205,23 +205,23 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
and then redirect to the address it returns. */ and then redirect to the address it returns. */
#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \ #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
asm ( "\ asm ( "\
.text .text\n\
.globl " #tramp_name " .globl " #tramp_name "\n\
.type " #tramp_name ", @function .type " #tramp_name ", @function\n\
.align 32 .align 32\n\
" #tramp_name ": " #tramp_name ":\n\
/* Set up the arguments to fixup -- /* Set up the arguments to fixup --\n\
%o0 = link_map out of plt0 %o0 = link_map out of plt0\n\
%o1 = offset of reloc entry %o1 = offset of reloc entry\n\
%o2 = return address */ %o2 = return address */\n\
ld [%o7 + 8], %o0 ld [%o7 + 8], %o0\n\
srl %g1, 10, %o1 srl %g1, 10, %o1\n\
mov %i7, %o2 mov %i7, %o2\n\
call " #fixup_name " call " #fixup_name "\n\
sub %o1, 4*12, %o1 sub %o1, 4*12, %o1\n\
jmp %o0 jmp %o0\n\
restore restore\n\
.size " #tramp_name ", . - " #tramp_name " .size " #tramp_name ", . - " #tramp_name "\n\
.previous") .previous")
#ifndef PROF #ifndef PROF
@ -256,96 +256,96 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
its return value is the user program's entry point. */ its return value is the user program's entry point. */
#define RTLD_START __asm__ ("\ #define RTLD_START __asm__ ("\
.text .text\n\
.globl _start .globl _start\n\
.type _start, @function .type _start, @function\n\
.align 32 .align 32\n\
_start: _start:\n\
/* Allocate space for functions to drop their arguments. */ /* Allocate space for functions to drop their arguments. */\n\
sub %sp, 6*4, %sp sub %sp, 6*4, %sp\n\
/* Pass pointer to argument block to _dl_start. */ /* Pass pointer to argument block to _dl_start. */\n\
call _dl_start call _dl_start\n\
add %sp, 22*4, %o0 add %sp, 22*4, %o0\n\
/* FALTHRU */ /* FALTHRU */\n\
.globl _dl_start_user .globl _dl_start_user\n\
.type _dl_start_user, @function .type _dl_start_user, @function\n\
_dl_start_user: _dl_start_user:\n\
/* Load the PIC register. */ /* Load the PIC register. */\n\
1: call 2f 1: call 2f\n\
sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7 sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n\
2: or %l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7 2: or %l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n\
add %l7, %o7, %l7 add %l7, %o7, %l7\n\
/* Save the user entry point address in %l0 */ /* Save the user entry point address in %l0 */\n\
mov %o0, %l0 mov %o0, %l0\n\
/* Store the highest stack address. */ /* Store the highest stack address. */\n\
sethi %hi(__libc_stack_end), %g2 sethi %hi(__libc_stack_end), %g2\n\
or %g2, %lo(__libc_stack_end), %g2 or %g2, %lo(__libc_stack_end), %g2\n\
ld [%l7 + %g2], %l1 ld [%l7 + %g2], %l1\n\
sethi %hi(_dl_skip_args), %g2 sethi %hi(_dl_skip_args), %g2\n\
add %sp, 6*4, %l2 add %sp, 6*4, %l2\n\
or %g2, %lo(_dl_skip_args), %g2 or %g2, %lo(_dl_skip_args), %g2\n\
st %l2, [%l1] st %l2, [%l1]\n\
/* See if we were run as a command with the executable file name as an /* See if we were run as a command with the executable file name as an\n\
extra leading argument. If so, adjust the contents of the stack. */ extra leading argument. If so, adjust the contents of the stack. */\n\
ld [%l7+%g2], %i0 ld [%l7+%g2], %i0\n\
ld [%i0], %i0 ld [%i0], %i0\n\
tst %i0 tst %i0\n\
beq 3f beq 3f\n\
ld [%sp+22*4], %i5 /* load argc */ ld [%sp+22*4], %i5 /* load argc */\n\
/* Find out how far to shift. */ /* Find out how far to shift. */\n\
sethi %hi(_dl_argv), %l3 sethi %hi(_dl_argv), %l3\n\
or %l3, %lo(_dl_argv), %l3 or %l3, %lo(_dl_argv), %l3\n\
ld [%l7+%l3], %l3 ld [%l7+%l3], %l3\n\
sub %i5, %i0, %i5 sub %i5, %i0, %i5\n\
ld [%l3], %l4 ld [%l3], %l4\n\
sll %i0, 2, %i2 sll %i0, 2, %i2\n\
st %i5, [%sp+22*4] st %i5, [%sp+22*4]\n\
sub %l4, %i2, %l4 sub %l4, %i2, %l4\n\
add %sp, 23*4, %i1 add %sp, 23*4, %i1\n\
add %i1, %i2, %i2 add %i1, %i2, %i2\n\
st %l4, [%l3] st %l4, [%l3]\n\
/* Copy down argv */ /* Copy down argv */\n\
21: ld [%i2], %i3 21: ld [%i2], %i3\n\
add %i2, 4, %i2 add %i2, 4, %i2\n\
tst %i3 tst %i3\n\
st %i3, [%i1] st %i3, [%i1]\n\
bne 21b bne 21b\n\
add %i1, 4, %i1 add %i1, 4, %i1\n\
/* Copy down env */ /* Copy down env */\n\
22: ld [%i2], %i3 22: ld [%i2], %i3\n\
add %i2, 4, %i2 add %i2, 4, %i2\n\
tst %i3 tst %i3\n\
st %i3, [%i1] st %i3, [%i1]\n\
bne 22b bne 22b\n\
add %i1, 4, %i1 add %i1, 4, %i1\n\
/* Copy down auxiliary table. */ /* Copy down auxiliary table. */\n\
23: ld [%i2], %i3 23: ld [%i2], %i3\n\
ld [%i2+4], %i4 ld [%i2+4], %i4\n\
add %i2, 8, %i2 add %i2, 8, %i2\n\
tst %i3 tst %i3\n\
st %i3, [%i1] st %i3, [%i1]\n\
st %i4, [%i1+4] st %i4, [%i1+4]\n\
bne 23b bne 23b\n\
add %i1, 8, %i1 add %i1, 8, %i1\n\
/* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp. */ /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp. */\n\
3: sethi %hi(_rtld_local), %o0 3: sethi %hi(_rtld_local), %o0\n\
add %sp, 23*4, %o2 add %sp, 23*4, %o2\n\
orcc %o0, %lo(_rtld_local), %o0 orcc %o0, %lo(_rtld_local), %o0\n\
sll %i5, 2, %o3 sll %i5, 2, %o3\n\
ld [%l7+%o0], %o0 ld [%l7+%o0], %o0\n\
add %o3, 4, %o3 add %o3, 4, %o3\n\
mov %i5, %o1 mov %i5, %o1\n\
add %o2, %o3, %o3 add %o2, %o3, %o3\n\
call _dl_init_internal call _dl_init_internal\n\
ld [%o0], %o0 ld [%o0], %o0\n\
/* Pass our finalizer function to the user in %g1. */ /* Pass our finalizer function to the user in %g1. */\n\
sethi %hi(_dl_fini), %g1 sethi %hi(_dl_fini), %g1\n\
or %g1, %lo(_dl_fini), %g1 or %g1, %lo(_dl_fini), %g1\n\
ld [%l7+%g1], %g1 ld [%l7+%g1], %g1\n\
/* Jump to the user's entry point and deallocate the extra stack we got. */ /* Jump to the user's entry point and deallocate the extra stack we got. */\n\
jmp %l0 jmp %l0\n\
add %sp, 6*4, %sp add %sp, 6*4, %sp\n\
.size _dl_start_user, . - _dl_start_user .size _dl_start_user, . - _dl_start_user\n\
.previous"); .previous");
static inline Elf32_Addr static inline Elf32_Addr

View File

@ -32,12 +32,12 @@ extern int rtc_upper (void);
extern int rtc_lower (void); extern int rtc_lower (void);
/* Assembler Routines to access the timer registers */ /* Assembler Routines to access the timer registers */
asm(" asm("\n\
.rtc_upper: mfspr 3,4 # copy RTCU to return register .rtc_upper: mfspr 3,4 # copy RTCU to return register\n\
blr blr\n\
\n\
.rtc_lower: mfspr 3,5 # copy RTCL to return register .rtc_lower: mfspr 3,5 # copy RTCL to return register\n\
blr blr\n\
"); ");
/* Get the current time of day and timezone information, /* Get the current time of day and timezone information,

View File

@ -1,5 +1,5 @@
/* Dump registers. /* Dump registers.
Copyright (C) 1998 Free Software Foundation, Inc. Copyright (C) 1998, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@gnu.org>. Contributed by Andreas Schwab <schwab@gnu.org>.
@ -51,15 +51,15 @@
static void __attribute__ ((unused)) static void __attribute__ ((unused))
__dummy__ (void) __dummy__ (void)
{ {
asm (" asm ("\n\
catch_segfault: catch_segfault:\n\
move.l 12(%%sp),%%a0 move.l 12(%%sp),%%a0\n\
lea %c0(%%a0),%%a0 lea %c0(%%a0),%%a0\n\
/* Clear the first 4 bytes to make it a null fp state, just /* Clear the first 4 bytes to make it a null fp state, just\n\
in case the handler does return. */ in case the handler does return. */\n\
clr.l (%%a0)+ clr.l (%%a0)+\n\
movem.l %%d2-%%d7/%%a2-%%a6,(%%a0) movem.l %%d2-%%d7/%%a2-%%a6,(%%a0)\n\
fmovem.x %%fp2-%%fp7,11*4(%%a0) fmovem.x %%fp2-%%fp7,11*4(%%a0)\n\
jra real_catch_segfault" jra real_catch_segfault"
: : "n" (offsetof (struct sigcontext, sc_fpstate))); : : "n" (offsetof (struct sigcontext, sc_fpstate)));
} }