summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2013-12-23 22:13:03 +0000
committerkettenis <kettenis@openbsd.org>2013-12-23 22:13:03 +0000
commitffd71c82a1f506e30b549ec6eaadc26e2fa17cc0 (patch)
tree714b3b430e35d1fb145ba476a84bb7824f6402f1
parentMake ld.so pass its cleanup handler in r7 as required by the PowerPC System V (diff)
downloadwireguard-openbsd-ffd71c82a1f506e30b549ec6eaadc26e2fa17cc0.tar.xz
wireguard-openbsd-ffd71c82a1f506e30b549ec6eaadc26e2fa17cc0.zip
Make ld.so pass its cleanup handler in %rdx as required by the AMD64 System V
ABI, and stop calling atexit(4) directly from ld.so on amd64. Note that this means that binaries built before the middle of november may no longer call destructors in shared libraries implemented in C++. Update your packages! ok guenther@
-rw-r--r--libexec/ld.so/amd64/ldasm.S6
-rw-r--r--libexec/ld.so/loader.c6
2 files changed, 5 insertions, 7 deletions
diff --git a/libexec/ld.so/amd64/ldasm.S b/libexec/ld.so/amd64/ldasm.S
index da470d97c33..00b4e8cf3d2 100644
--- a/libexec/ld.so/amd64/ldasm.S
+++ b/libexec/ld.so/amd64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.13 2013/08/13 05:52:18 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.14 2013/12/23 22:13:03 kettenis Exp $ */
/*
* Copyright (c) 2002,2004 Dale Rahn
@@ -63,9 +63,7 @@ _dl_start:
addq $DL_DATA_SIZE,%rsp # return dl_data
-# popq %rbx # %rbx = ps_strings - XXXDSR
-# popq %rcx # %rcx = obj_main - XXXDSR
- movq $0, %rdx # %rdx = cleanup - XXXDSR
+ leaq _dl_dtors(%rip), %rdx # %rdx = cleanup
movq %r12, %rsp
jmp *%rax
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index 84e41b2040e..e7b8e2861db 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.139 2013/12/23 22:03:52 kettenis Exp $ */
+/* $OpenBSD: loader.c,v 1.140 2013/12/23 22:13:03 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -604,8 +604,8 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data)
_dl_call_init(_dl_objects);
}
-#if !defined(__alpha__) && !defined(__hppa__) && !defined(__i386__) && \
- !defined(__powerpc__) && !defined(__sparc64__)
+#if !defined(__alpha__) && !defined(__amd64__) && !defined(__hppa__) && \
+ !defined(__i386__) && !defined(__powerpc__) && !defined(__sparc64__)
/*
* Schedule a routine to be run at shutdown, by using atexit.
* Cannot call atexit directly from ld.so?