(CALL_ROUTINE): Deleted.

(BX): Define.
(ELF_MACHINE_RUNTIME_TRAMPOLINE): Optimise a little.
This commit is contained in:
Ulrich Drepper 2003-09-17 18:09:25 +00:00
parent 170880ee26
commit 12a15026b8
1 changed files with 30 additions and 42 deletions

View File

@ -123,22 +123,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
return lazy; return lazy;
} }
/* This code is used in dl-runtime.c to call the `fixup' function #if defined(__THUMB_INTERWORK__)
and then redirect to the address it returns. */ #define BX(x) "bx\t" #x
// macro for handling PIC situation....
#ifdef PIC
#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 #else
#define CALL_ROUTINE(x) " bl " #x #define BX(x) "mov\tpc, " #x
#endif #endif
#ifndef PROF #ifndef PROF
@ -153,29 +141,29 @@ _dl_runtime_resolve:\n\
@ ip contains &GOT[n+3] (pointer to function)\n\ @ ip contains &GOT[n+3] (pointer to function)\n\
@ lr points to &GOT[2]\n\ @ lr points to &GOT[2]\n\
\n\ \n\
@ save almost everything; lr is already on the stack\n\ @ stack arguments\n\
stmdb sp!,{r0-r3,sl,fp}\n\ stmdb sp!,{r0-r3}\n\
\n\
@ get pointer to linker struct\n\
ldr r0, [lr, #-4]\n\
\n\ \n\
@ prepare to call fixup()\n\ @ prepare to call fixup()\n\
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
sub r1, ip, lr\n\ sub r1, ip, lr\n\
sub r1, r1, #4\n\ sub r1, r1, #4\n\
add r1, r1, r1\n\ add r1, r1, r1\n\
\n\
@ get pointer to linker struct\n\
ldr r0, [lr, #-4]\n\
\n\ \n\
@ call fixup routine\n\ @ call fixup routine\n\
" CALL_ROUTINE(fixup) "\n\ bl fixup\n\
\n\ \n\
@ save the return\n\ @ save the return\n\
mov ip, r0\n\ mov ip, r0\n\
\n\ \n\
@ restore the stack\n\ @ get arguments and return address back\n\
ldmia sp!,{r0-r3,sl,fp,lr}\n\ ldmia sp!, {r0-r3,lr}\n\
\n\ \n\
@ jump to the newly found address\n\ @ jump to the newly found address\n\
mov pc, ip\n\ " BX(ip) "\n\
\n\ \n\
.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
\n\ \n\
@ -183,29 +171,29 @@ _dl_runtime_resolve:\n\
.type _dl_runtime_profile, #function\n\ .type _dl_runtime_profile, #function\n\
.align 2\n\ .align 2\n\
_dl_runtime_profile:\n\ _dl_runtime_profile:\n\
@ save almost everything; lr is already on the stack\n\ @ stack arguments\n\
stmdb sp!,{r0-r3,sl,fp}\n\ stmdb sp!, {r0-r3}\n\
\n\
@ get pointer to linker struct\n\
ldr r0, [lr, #-4]\n\
\n\ \n\
@ prepare to call fixup()\n\ @ prepare to call fixup()\n\
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
sub r1, ip, lr\n\ sub r1, ip, lr\n\
sub r1, r1, #4\n\ sub r1, r1, #4\n\
add r1, r1, r1\n\ add r1, r1, r1\n\
\n\
@ get pointer to linker struct\n\
ldr r0, [lr, #-4]\n\
\n\ \n\
@ call profiling fixup routine\n\ @ call profiling fixup routine\n\
" CALL_ROUTINE(profile_fixup) "\n\ bl profile_fixup\n\
\n\ \n\
@ save the return\n\ @ save the return\n\
mov ip, r0\n\ mov ip, r0\n\
\n\ \n\
@ restore the stack\n\ @ get arguments and return address back\n\
ldmia sp!,{r0-r3,sl,fp,lr}\n\ ldmia sp!, {r0-r3,lr}\n\
\n\ \n\
@ jump to the newly found address\n\ @ jump to the newly found address\n\
mov pc, ip\n\ " BX(ip) "\n\
\n\ \n\
.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
.previous\n\ .previous\n\
@ -225,29 +213,29 @@ _dl_runtime_profile:\n\
@ ip contains &GOT[n+3] (pointer to function)\n\ @ ip contains &GOT[n+3] (pointer to function)\n\
@ lr points to &GOT[2]\n\ @ lr points to &GOT[2]\n\
\n\ \n\
@ save almost everything; return add is already on the stack\n\ @ stack arguments\n\
stmdb sp!,{r0-r3,sl,fp}\n\ stmdb sp!, {r0-r3}\n\
\n\
@ get pointer to linker struct\n\
ldr r0, [lr, #-4]\n\
\n\ \n\
@ prepare to call fixup()\n\ @ prepare to call fixup()\n\
@ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
sub r1, ip, lr\n\ sub r1, ip, lr\n\
sub r1, r1, #4\n\ sub r1, r1, #4\n\
add r1, r1, r1\n\ add r1, r1, r1\n\
\n\
@ get pointer to linker struct\n\
ldr r0, [lr, #-4]\n\
\n\ \n\
@ call profiling fixup routine\n\ @ call profiling fixup routine\n\
" CALL_ROUTINE(fixup) "\n\ bl fixup\n\
\n\ \n\
@ save the return\n\ @ save the return\n\
mov ip, r0\n\ mov ip, r0\n\
\n\ \n\
@ restore the stack\n\ @ get arguments and return address back\n\
ldmia sp!,{r0-r3,sl,fp,lr}\n\ ldmia sp!, {r0-r3,lr}\n\
\n\ \n\
@ jump to the newly found address\n\ @ jump to the newly found address\n\
mov pc, ip\n\ " BX(ip) "\n\
\n\ \n\
.size _dl_runtime_profile, .-_dl_runtime_profile\n\ .size _dl_runtime_profile, .-_dl_runtime_profile\n\
.previous\n\ .previous\n\