diff options
author | 2013-12-25 15:14:59 +0000 | |
---|---|---|
committer | 2013-12-25 15:14:59 +0000 | |
commit | 62f6567b810b733d20da69b621880348bf58e7cc (patch) | |
tree | 718dc496f52e17d4a06d7f975d505a4adc21d46c | |
parent | Garbage collect two local variables each used only one single time. (diff) | |
download | wireguard-openbsd-62f6567b810b733d20da69b621880348bf58e7cc.tar.xz wireguard-openbsd-62f6567b810b733d20da69b621880348bf58e7cc.zip |
Pass _dl_dtors as the csu cleanup routine on sh
-rw-r--r-- | libexec/ld.so/loader.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/sh/ldasm.S | 16 |
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 |