summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-12-25 15:15:00 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-12-25 15:15:00 +0000
commit5b38e470abaa27518dd85d8b91e543bd2170b9ee (patch)
tree860184ba6d249905076d98686cf2376d9a5b46df /libexec
parent98c9275f1064d0914746e68950c9ba450c7df307 (diff)
Pass _dl_dtors as the csu cleanup routine on sh
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/loader.c4
-rw-r--r--libexec/ld.so/sh/ldasm.S16
2 files changed, 15 insertions, 5 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index c978e269e31..b857777235a 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.143 2013/12/25 15:01:39 miod Exp $ */
+/* $OpenBSD: loader.c,v 1.144 2013/12/25 15:14:59 miod Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -604,7 +604,7 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data)
_dl_call_init(_dl_objects);
}
-#if defined(__mips64__) || defined(__sh__) /* XXX */
+#if defined(__mips64__) /* XXX */
/*
* Schedule a routine to be run at shutdown, by using atexit.
* Cannot call atexit directly from ld.so?
diff --git a/libexec/ld.so/sh/ldasm.S b/libexec/ld.so/sh/ldasm.S
index 5a93d4748f0..fe6eb18899c 100644
--- a/libexec/ld.so/sh/ldasm.S
+++ b/libexec/ld.so/sh/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.12 2013/08/13 05:52:20 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.13 2013/12/25 15:14:59 miod Exp $ */
/*
* Copyright (c) 2006 Dale Rahn
@@ -85,8 +85,14 @@ ENTRY(_dl_start)
add #1, r6
shll2 r6
add r5, r6 // calc envp
- jmp @r0
- mov #0, r7
+
+ mov r0, r12
+ mova .L_GOT, r0
+ mov.l .L_GOT, r7
+ add r7, r0 // GOT
+ mov.l .L_dl_dtors, r7
+ jmp @r12
+ mov.l @(r0,r7), r7 // cleanup
.align 2
.L_boot_bind:
@@ -99,6 +105,10 @@ ENTRY(_dl_start)
.long _DYNAMIC-.L_offbase
.L_loff:
.long 7*4
+.L_GOT:
+ .long _GLOBAL_OFFSET_TABLE_
+.L_dl_dtors:
+ .long _dl_dtors@GOT
.size _dl_start, .-dl_start