diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-12-23 10:39:11 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-12-23 10:39:11 +0000 |
commit | a5404c468773c76c9a6c3ee521563ed6757c384f (patch) | |
tree | 1062f9bc3d617f1bba8ce8e2d228acaa06f5d890 /libexec/ld.so | |
parent | ee44cc1f44ee7b9f8d8382321a695d37173466ce (diff) |
Make ld.so pass its cleanup handler in %edx as required by the i386 System V
ABI, and stop calling atexit(4) directly from ld.so on i386.
ok guenther@
Diffstat (limited to 'libexec/ld.so')
-rw-r--r-- | libexec/ld.so/i386/ldasm.S | 11 | ||||
-rw-r--r-- | libexec/ld.so/loader.c | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/libexec/ld.so/i386/ldasm.S b/libexec/ld.so/i386/ldasm.S index d20a7ae65bd..76aa87a6795 100644 --- a/libexec/ld.so/i386/ldasm.S +++ b/libexec/ld.so/i386/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.15 2013/08/13 05:52:19 guenther Exp $ */ +/* $OpenBSD: ldasm.S,v 1.16 2013/12/23 10:39:10 kettenis Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -38,7 +38,6 @@ .type _dl_start,@function _dl_start: movl %esp,%eax # save stack pointer for _rtld - pushl %ebx # save ps_strings subl $DL_DATA_SIZE,%esp # allocate dl_data pushl $0 # push 0 for dynamicp (unused on i386) movl %esp,%ebx @@ -72,9 +71,11 @@ _dl_start: addl $DL_DATA_SIZE,%esp # return dl_data - popl %ebx # %ebx = ps_strings - movl $0,%edx # %edx = cleanup - XXXDSR - movl $0,%ecx # %ecx = obj_main - XXXDSR + call 1f # %edx = cleanup +1: popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx + leal _dl_dtors@GOTOFF(%ebx), %edx + jmp *%eax diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 22302d9f711..4bbdf953d08 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.133 2013/06/01 09:57:55 miod Exp $ */ +/* $OpenBSD: loader.c,v 1.134 2013/12/23 10:39:10 kettenis Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -604,6 +604,7 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data) _dl_call_init(_dl_objects); } +#if !defined(__i386__) /* * Schedule a routine to be run at shutdown, by using atexit. * Cannot call atexit directly from ld.so? @@ -628,6 +629,7 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data) ((Elf_Addr)_dl_dtors); #endif } +#endif DL_DEB(("entry point: 0x%lx\n", dl_data[AUX_entry])); |