summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-12-23 17:29:16 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-12-23 17:29:16 +0000
commit0c5de94ca6548a0f863c4e0084679da410c4f160 (patch)
tree8a12f444da8c35fe79533d6a7e27d9e2923ff40a /libexec
parent068bc87f058ec1a37c96bbc5b95537da924485f5 (diff)
Make ld.so pass its cleanup handler in %g1 as required by the SPARC System V
ABI, and stop calling atexit(4) directly from ld.so on sparc64
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/loader.c4
-rw-r--r--libexec/ld.so/sparc64/ldasm.S9
2 files changed, 9 insertions, 4 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index e634e96e3cc..0ac37b8e5b4 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.136 2013/12/23 14:13:03 kettenis Exp $ */
+/* $OpenBSD: loader.c,v 1.137 2013/12/23 17:29:15 kettenis 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(__hppa__) && !defined(__i386__)
+#if !defined(__hppa__) && !defined(__i386__) && !defined(__sparc64__)
/*
* Schedule a routine to be run at shutdown, by using atexit.
* Cannot call atexit directly from ld.so?
diff --git a/libexec/ld.so/sparc64/ldasm.S b/libexec/ld.so/sparc64/ldasm.S
index 982deaaee59..209fdf1a74a 100644
--- a/libexec/ld.so/sparc64/ldasm.S
+++ b/libexec/ld.so/sparc64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.32 2013/08/13 05:52:21 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.33 2013/12/23 17:29:15 kettenis Exp $ */
/* $NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $ */
/*
@@ -129,8 +129,13 @@ _ENTRY(_dl_start)
add %sp, 48 + DL_DATA_SIZE, %sp ! restore stack
+ sethi %hi(_GLOBAL_OFFSET_TABLE_ - 4), %l7
+ rd %pc, %g1
+ or %l7, %lo(_GLOBAL_OFFSET_TABLE_ + 4), %l7
+ add %l7, %g1, %l7
+
jmp %o0
- clr %g1 ! XXX don't register with atexit
+ ldx [%l7 + _dl_dtors], %g1 ! %g1 = cleanup
/*
* We have two separate entry points to the runtime linker.