From: kettenis Date: Wed, 25 Dec 2013 11:10:02 +0000 (+0000) Subject: Make ld.so pass its cleanup handler in %g1 as required by the SPARC System V X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2d30e9ae53071f506f9189c2de6bd52eb93c92e5;p=openbsd 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 sparc. --- diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index e7b8e2861db..275542cb4a0 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.140 2013/12/23 22:13:03 kettenis Exp $ */ +/* $OpenBSD: loader.c,v 1.141 2013/12/25 11:10:02 kettenis Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -605,7 +605,8 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data) } #if !defined(__alpha__) && !defined(__amd64__) && !defined(__hppa__) && \ - !defined(__i386__) && !defined(__powerpc__) && !defined(__sparc64__) + !defined(__i386__) && !defined(__powerpc__) && !defined(__sparc__) && \ + !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/sparc/ldasm.S b/libexec/ld.so/sparc/ldasm.S index ab6e633e058..17112f54374 100644 --- a/libexec/ld.so/sparc/ldasm.S +++ b/libexec/ld.so/sparc/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.21 2013/08/13 05:52:21 guenther Exp $ */ +/* $OpenBSD: ldasm.S,v 1.22 2013/12/25 11:10:02 kettenis Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -113,8 +113,13 @@ _dl_start: add %sp, 32 + DL_DATA_SIZE, %sp ! restore stack +1: call 2f + sethi %hi(_GLOBAL_OFFSET_TABLE_+(.-1b)), %l7 +2: or %l7, %lo(_GLOBAL_OFFSET_TABLE_+(.-1b)), %l7 + add %l7, %o7, %l7 + jmp %o0 - clr %g1 ! XXX don't register with atexit + ld [%l7 + _dl_dtors], %g1 ! %g1 = cleanup .section ".text"