Avoid unescaped newlines in string constants.

This commit is contained in:
Ulrich Drepper 2002-08-28 21:26:20 +00:00
parent 48fa58aa12
commit bbb3856d85
4 changed files with 269 additions and 268 deletions

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. */
// macro for handling PIC situation....
#ifdef PIC
#define CALL_ROUTINE(x) " ldr sl,0f
add sl, pc, sl
1: ldr r2, 2f
mov lr, pc
add pc, sl, r2
b 3f
0: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4
2: .word " #x "(GOTOFF)
#define CALL_ROUTINE(x) "\
ldr sl,0f\n\
add sl, pc, sl\n\
1: ldr r2, 2f\n\
mov lr, pc\n\
add pc, sl, r2\n\
b 3f\n\
0: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4\n\
2: .word " #x "(GOTOFF)\n\
3: "
#else
#define CALL_ROUTINE(x) " bl " #x
@ -141,114 +142,114 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
#ifndef PROF
# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
.text
.globl _dl_runtime_resolve
.type _dl_runtime_resolve, #function
.align 2
_dl_runtime_resolve:
@ we get called with
@ stack[0] contains the return address from this call
@ ip contains &GOT[n+3] (pointer to function)
@ lr points to &GOT[2]
@ save almost everything; lr is already on the stack
stmdb sp!,{r0-r3,sl,fp}
@ prepare to call fixup()
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
sub r1, ip, lr
sub r1, r1, #4
add r1, r1, r1
@ get pointer to linker struct
ldr r0, [lr, #-4]
@ call fixup routine
" CALL_ROUTINE(fixup) "
@ save the return
mov ip, r0
@ restore the stack
ldmia sp!,{r0-r3,sl,fp,lr}
@ jump to the newly found address
mov pc, ip
.size _dl_runtime_resolve, .-_dl_runtime_resolve
.globl _dl_runtime_profile
.type _dl_runtime_profile, #function
.align 2
_dl_runtime_profile:
@ save almost everything; lr is already on the stack
stmdb sp!,{r0-r3,sl,fp}
@ prepare to call fixup()
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
sub r1, ip, lr
sub r1, r1, #4
add r1, r1, r1
@ get pointer to linker struct
ldr r0, [lr, #-4]
@ call profiling fixup routine
" CALL_ROUTINE(profile_fixup) "
@ save the return
mov ip, r0
@ restore the stack
ldmia sp!,{r0-r3,sl,fp,lr}
@ jump to the newly found address
mov pc, ip
.size _dl_runtime_resolve, .-_dl_runtime_resolve
.previous
.text\n\
.globl _dl_runtime_resolve\n\
.type _dl_runtime_resolve, #function\n\
.align 2\n\
_dl_runtime_resolve:\n\
@ we get called with\n\
@ stack[0] contains the return address from this call\n\
@ ip contains &GOT[n+3] (pointer to function)\n\
@ lr points to &GOT[2]\n\
\n\
@ save almost everything; lr is already on the stack\n\
stmdb sp!,{r0-r3,sl,fp}\n\
\n\
@ prepare to call fixup()\n\
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
sub r1, ip, lr\n\
sub r1, r1, #4\n\
add r1, r1, r1\n\
\n\
@ get pointer to linker struct\n\
ldr r0, [lr, #-4]\n\
\n\
@ call fixup routine\n\
" CALL_ROUTINE(fixup) "\n\
\n\
@ save the return\n\
mov ip, r0\n\
\n\
@ restore the stack\n\
ldmia sp!,{r0-r3,sl,fp,lr}\n\
\n\
@ jump to the newly found address\n\
mov pc, ip\n\
\n\
.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
\n\
.globl _dl_runtime_profile\n\
.type _dl_runtime_profile, #function\n\
.align 2\n\
_dl_runtime_profile:\n\
@ save almost everything; lr is already on the stack\n\
stmdb sp!,{r0-r3,sl,fp}\n\
\n\
@ prepare to call fixup()\n\
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
sub r1, ip, lr\n\
sub r1, r1, #4\n\
add r1, r1, r1\n\
\n\
@ get pointer to linker struct\n\
ldr r0, [lr, #-4]\n\
\n\
@ call profiling fixup routine\n\
" CALL_ROUTINE(profile_fixup) "\n\
\n\
@ save the return\n\
mov ip, r0\n\
\n\
@ restore the stack\n\
ldmia sp!,{r0-r3,sl,fp,lr}\n\
\n\
@ jump to the newly found address\n\
mov pc, ip\n\
\n\
.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
.previous\n\
");
#else // PROF
# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
.text
.globl _dl_runtime_resolve
.globl _dl_runtime_profile
.type _dl_runtime_resolve, #function
.type _dl_runtime_profile, #function
.align 2
_dl_runtime_resolve:
_dl_runtime_profile:
@ we get called with
@ stack[0] contains the return address from this call
@ ip contains &GOT[n+3] (pointer to function)
@ lr points to &GOT[2]
@ save almost everything; return add is already on the stack
stmdb sp!,{r0-r3,sl,fp}
@ prepare to call fixup()
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
sub r1, ip, lr
sub r1, r1, #4
add r1, r1, r1
@ get pointer to linker struct
ldr r0, [lr, #-4]
@ call profiling fixup routine
" CALL_ROUTINE(fixup) "
@ save the return
mov ip, r0
@ restore the stack
ldmia sp!,{r0-r3,sl,fp,lr}
@ jump to the newly found address
mov pc, ip
.size _dl_runtime_profile, .-_dl_runtime_profile
.previous
.text\n\
.globl _dl_runtime_resolve\n\
.globl _dl_runtime_profile\n\
.type _dl_runtime_resolve, #function\n\
.type _dl_runtime_profile, #function\n\
.align 2\n\
_dl_runtime_resolve:\n\
_dl_runtime_profile:\n\
@ we get called with\n\
@ stack[0] contains the return address from this call\n\
@ ip contains &GOT[n+3] (pointer to function)\n\
@ lr points to &GOT[2]\n\
\n\
@ save almost everything; return add is already on the stack\n\
stmdb sp!,{r0-r3,sl,fp}\n\
\n\
@ prepare to call fixup()\n\
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
sub r1, ip, lr\n\
sub r1, r1, #4\n\
add r1, r1, r1\n\
\n\
@ get pointer to linker struct\n\
ldr r0, [lr, #-4]\n\
\n\
@ call profiling fixup routine\n\
" CALL_ROUTINE(fixup) "\n\
\n\
@ save the return\n\
mov ip, r0\n\
\n\
@ restore the stack\n\
ldmia sp!,{r0-r3,sl,fp,lr}\n\
\n\
@ jump to the newly found address\n\
mov pc, ip\n\
\n\
.size _dl_runtime_profile, .-_dl_runtime_profile\n\
.previous\n\
");
#endif //PROF
@ -261,70 +262,70 @@ _dl_runtime_profile:
its return value is the user program's entry point. */
#define RTLD_START asm ("\
.text
.globl _start
.globl _dl_start_user
_start:
@ at start time, all the args are on the stack
mov r0, sp
bl _dl_start
@ returns user entry point in r0
_dl_start_user:
mov r6, r0
@ we are PIC code, so get global offset table
ldr sl, .L_GET_GOT
add sl, pc, sl
.L_GOT_GOT:
@ Store the highest stack address
ldr r1, .L_STACK_END
ldr r1, [sl, r1]
str sp, [r1]
@ See if we were run as a command with the executable file
@ name as an extra leading argument.
ldr r4, .L_SKIP_ARGS
ldr r4, [sl, r4]
@ get the original arg count
ldr r1, [sp]
@ subtract _dl_skip_args from it
sub r1, r1, r4
@ adjust the stack pointer to skip them
add sp, sp, r4, lsl #2
@ get the argv address
add r2, sp, #4
@ store the new argc in the new stack location
str r1, [sp]
@ compute envp
add r3, r2, r1, lsl #2
add r3, r3, #4
@ now we call _dl_init
ldr r0, .L_LOADED
ldr r0, [sl, r0]
ldr r0, [r0]
@ call _dl_init
bl _dl_init_internal(PLT)
@ clear the startup flag
ldr r2, .L_STARTUP_FLAG
ldr r1, [sl, r2]
mov r0, #0
str r0, [r1]
@ load the finalizer function
ldr r0, .L_FINI_PROC
ldr r0, [sl, r0]
@ jump to the user_s entry point
mov pc, r6
.L_GET_GOT:
.word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4 \n\
.L_SKIP_ARGS: \n\
.word _dl_skip_args(GOTOFF) \n\
.L_STARTUP_FLAG:
.word _dl_starting_up(GOT)
.L_FINI_PROC:
.word _dl_fini(GOT)
.L_STACK_END:
.word __libc_stack_end(GOT)
.L_LOADED:
.word _rtld_local(GOT)
.text\n\
.globl _start\n\
.globl _dl_start_user\n\
_start:\n\
@ at start time, all the args are on the stack\n\
mov r0, sp\n\
bl _dl_start\n\
@ returns user entry point in r0\n\
_dl_start_user:\n\
mov r6, r0\n\
@ we are PIC code, so get global offset table\n\
ldr sl, .L_GET_GOT\n\
add sl, pc, sl\n\
.L_GOT_GOT:\n\
@ Store the highest stack address\n\
ldr r1, .L_STACK_END\n\
ldr r1, [sl, r1]\n\
str sp, [r1]\n\
@ See if we were run as a command with the executable file\n\
@ name as an extra leading argument.\n\
ldr r4, .L_SKIP_ARGS\n\
ldr r4, [sl, r4]\n\
@ get the original arg count\n\
ldr r1, [sp]\n\
@ subtract _dl_skip_args from it\n\
sub r1, r1, r4\n\
@ adjust the stack pointer to skip them\n\
add sp, sp, r4, lsl #2\n\
@ get the argv address\n\
add r2, sp, #4\n\
@ store the new argc in the new stack location\n\
str r1, [sp]\n\
@ compute envp\n\
add r3, r2, r1, lsl #2\n\
add r3, r3, #4\n\
\n\
@ now we call _dl_init\n\
ldr r0, .L_LOADED\n\
ldr r0, [sl, r0]\n\
ldr r0, [r0]\n\
@ call _dl_init\n\
bl _dl_init_internal(PLT)\n\
@ clear the startup flag\n\
ldr r2, .L_STARTUP_FLAG\n\
ldr r1, [sl, r2]\n\
mov r0, #0\n\
str r0, [r1]\n\
@ load the finalizer function\n\
ldr r0, .L_FINI_PROC\n\
ldr r0, [sl, r0]\n\
@ jump to the user_s entry point\n\
mov pc, r6\n\
.L_GET_GOT:\n\
.word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n\
.L_SKIP_ARGS:\n\
.word _dl_skip_args(GOTOFF)\n\
.L_STARTUP_FLAG:\n\
.word _dl_starting_up(GOT)\n\
.L_FINI_PROC:\n\
.word _dl_fini(GOT)\n\
.L_STACK_END:\n\
.word __libc_stack_end(GOT)\n\
.L_LOADED:\n\
.word _rtld_local(GOT)\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. */
#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
"; Trampoline for " #fixup_name "
.globl " #tramp_name "
.type " #tramp_name ", @function
" #tramp_name ":
push $r13
push $r12
push $r11
push $r10
push $r9
push $srp
move.d [$sp+6*4],$r11
move $mof,$r10
" CALL_FN (fixup_name) "
move.d $r10,[$sp+6*4]
pop $srp
pop $r9
pop $r10
pop $r11
pop $r12
pop $r13
jump [$sp+]
"; Trampoline for " #fixup_name "\n\
.globl " #tramp_name "\n\
.type " #tramp_name ", @function\n\
" #tramp_name ":\n\
push $r13\n\
push $r12\n\
push $r11\n\
push $r10\n\
push $r9\n\
push $srp\n\
move.d [$sp+6*4],$r11\n\
move $mof,$r10\n\
" CALL_FN (fixup_name) "\n\
move.d $r10,[$sp+6*4]\n\
pop $srp\n\
pop $r9\n\
pop $r10\n\
pop $r11\n\
pop $r12\n\
pop $r13\n\
jump [$sp+]\n\
.size " #tramp_name ", . - " #tramp_name "\n"
#ifndef PROF
#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. */
#define RTLD_START asm ("\
.text
.globl _start
.type _start,@function
_start:
move.d $sp,$r10
" CALL_FN (_dl_start) "
/* FALLTHRU */
.globl _dl_start_user
.type _dl_start_user,@function
_dl_start_user:
; Save the user entry point address in R1.
move.d $r10,$r1
; Point R0 at the GOT.
move.d $pc,$r0
sub.d .:GOTOFF,$r0
; Remember the highest stack address.
move.d [$r0+__libc_stack_end:GOT16],$r13
move.d $sp,[$r13]
; See if we were run as a command with the executable file
; name as an extra leading argument.
move.d [$r0+_dl_skip_args:GOT16],$r13
move.d [$r13],$r9
; Get the original argument count
move.d [$sp],$r11
; Subtract _dl_skip_args from it.
sub.d $r9,$r11
; Adjust the stack pointer to skip _dl_skip_args words.
addi $r9.d,$sp
; Put the new argc in place as expected by the user entry.
move.d $r11,[$sp]
; Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
; env: skip scaled argc and skip stored argc and NULL at end of argv[].
move.d $sp,$r13
addi $r11.d,$r13
addq 8,$r13
; argv: skip stored argc.
move.d $sp,$r12
addq 4,$r12
; main_map: at _dl_loaded.
move.d [$r0+_rtld_local:GOT16],$r9
move.d [$r9],$r10
move.d _dl_init_internal:PLTG,$r9
add.d $r0,$r9
jsr $r9
; Pass our finalizer function to the user in R10.
move.d [$r0+_dl_fini:GOT16],$r10
; Terminate the frame-pointer.
moveq 0,$r8
; Cause SEGV if user entry returns.
move $r8,$srp
; Jump to the user's entry point.
jump $r1
.size _dl_start_user, . - _dl_start_user
.text\n\
.globl _start\n\
.type _start,@function\n\
_start:\n\
move.d $sp,$r10\n\
" CALL_FN (_dl_start) "\n\
/* FALLTHRU */\n\
\n\
.globl _dl_start_user\n\
.type _dl_start_user,@function\n\
_dl_start_user:\n\
; Save the user entry point address in R1.\n\
move.d $r10,$r1\n\
; Point R0 at the GOT.\n\
move.d $pc,$r0\n\
sub.d .:GOTOFF,$r0\n\
; Remember the highest stack address.\n\
move.d [$r0+__libc_stack_end:GOT16],$r13\n\
move.d $sp,[$r13]\n\
; See if we were run as a command with the executable file\n\
; name as an extra leading argument.\n\
move.d [$r0+_dl_skip_args:GOT16],$r13\n\
move.d [$r13],$r9\n\
; Get the original argument count\n\
move.d [$sp],$r11\n\
; Subtract _dl_skip_args from it.\n\
sub.d $r9,$r11\n\
; Adjust the stack pointer to skip _dl_skip_args words.\n\
addi $r9.d,$sp\n\
; Put the new argc in place as expected by the user entry.\n\
move.d $r11,[$sp]\n\
; 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[].\n\
move.d $sp,$r13\n\
addi $r11.d,$r13\n\
addq 8,$r13\n\
; argv: skip stored argc.\n\
move.d $sp,$r12\n\
addq 4,$r12\n\
; main_map: at _dl_loaded.\n\
move.d [$r0+_rtld_local:GOT16],$r9\n\
move.d [$r9],$r10\n\
move.d _dl_init_internal:PLTG,$r9\n\
add.d $r0,$r9\n\
jsr $r9\n\
; Pass our finalizer function to the user in R10.\n\
move.d [$r0+_dl_fini:GOT16],$r10\n\
; Terminate the frame-pointer.\n\
moveq 0,$r8\n\
; Cause SEGV if user entry returns.\n\
move $r8,$srp\n\
; Jump to the user's entry point.\n\
jump $r1\n\
.size _dl_start_user, . - _dl_start_user\n\
.previous");
/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so

View File

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

View File

@ -1,5 +1,5 @@
/* 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.
Contributed by Andreas Schwab <schwab@gnu.org>.
@ -51,15 +51,15 @@
static void __attribute__ ((unused))
__dummy__ (void)
{
asm ("
catch_segfault:
move.l 12(%%sp),%%a0
lea %c0(%%a0),%%a0
/* Clear the first 4 bytes to make it a null fp state, just
in case the handler does return. */
clr.l (%%a0)+
movem.l %%d2-%%d7/%%a2-%%a6,(%%a0)
fmovem.x %%fp2-%%fp7,11*4(%%a0)
asm ("\n\
catch_segfault:\n\
move.l 12(%%sp),%%a0\n\
lea %c0(%%a0),%%a0\n\
/* Clear the first 4 bytes to make it a null fp state, just\n\
in case the handler does return. */\n\
clr.l (%%a0)+\n\
movem.l %%d2-%%d7/%%a2-%%a6,(%%a0)\n\
fmovem.x %%fp2-%%fp7,11*4(%%a0)\n\
jra real_catch_segfault"
: : "n" (offsetof (struct sigcontext, sc_fpstate)));
}