summaryrefslogtreecommitdiff
path: root/libexec/ld.so
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-12-23 22:13:04 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-12-23 22:13:04 +0000
commitd9f786a661d4e8e791e4d5782beab269f9abcfb1 (patch)
tree56df33186afd97bd1ab47eb3d9f71be96d871aba /libexec/ld.so
parent5040264fa48945c5daa1ee784515bb1f63af9b37 (diff)
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@
Diffstat (limited to 'libexec/ld.so')
-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?