summaryrefslogtreecommitdiff
path: root/ldso/ldso/sh/dl-startup.h
diff options
context:
space:
mode:
Diffstat (limited to 'ldso/ldso/sh/dl-startup.h')
-rw-r--r--ldso/ldso/sh/dl-startup.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/ldso/ldso/sh/dl-startup.h b/ldso/ldso/sh/dl-startup.h
index 3e59093fa..05e282bd8 100644
--- a/ldso/ldso/sh/dl-startup.h
+++ b/ldso/ldso/sh/dl-startup.h
@@ -12,10 +12,20 @@ __asm__(
" bsrf r0\n"
" add #4, r4\n"
".jmp_loc:\n"
- " jmp @r0\n"
- " mov #0, r4 !call _start with arg == 0\n"
+ " mov r0, r8 ! Save the user entry point address in r8\n"
+ " mov.l .L_got, r12 ! Load the GOT on r12\n"
+ " mova .L_got, r0\n"
+ " add r0, r12\n"
+ " mov.l .L_dl_fini, r0\n"
+ " mov.l @(r0,r12), r4 ! Pass the finalizer in r4\n"
+ " jmp @r8\n"
+ " nop\n"
".L_dl_start:\n"
" .long _dl_start-.jmp_loc\n"
+ ".L_dl_fini:\n"
+ " .long _dl_fini@GOT\n"
+ ".L_got:\n"
+ " .long _GLOBAL_OFFSET_TABLE_\n"
" .size _start,.-_start\n"
" .previous\n"
);