From 9408922d0286a119b965d37524067981f4f1cd37 Mon Sep 17 00:00:00 2001 From: miod Date: Wed, 25 Dec 2013 13:06:00 +0000 Subject: [PATCH] Pass _dl_dtors as the csu cleanup routine on m68k and m88k; change the conditional in the MI code to only list the architectures left to adapt. --- libexec/ld.so/loader.c | 6 ++---- libexec/ld.so/m68k/ldasm.S | 5 ++--- libexec/ld.so/m88k/ldasm.S | 7 +++++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 275542cb4a0..b137fbc6033 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.141 2013/12/25 11:10:02 kettenis Exp $ */ +/* $OpenBSD: loader.c,v 1.142 2013/12/25 13:06:00 miod Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -604,9 +604,7 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data) _dl_call_init(_dl_objects); } -#if !defined(__alpha__) && !defined(__amd64__) && !defined(__hppa__) && \ - !defined(__i386__) && !defined(__powerpc__) && !defined(__sparc__) && \ - !defined(__sparc64__) +#if defined(__arm__) || defined(__mips64__) || defined(__sh__) /* XXX */ /* * Schedule a routine to be run at shutdown, by using atexit. * Cannot call atexit directly from ld.so? diff --git a/libexec/ld.so/m68k/ldasm.S b/libexec/ld.so/m68k/ldasm.S index 3fb9e308388..cf9687f1f52 100644 --- a/libexec/ld.so/m68k/ldasm.S +++ b/libexec/ld.so/m68k/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.5 2013/08/13 05:52:19 guenther Exp $ */ +/* $OpenBSD: ldasm.S,v 1.6 2013/12/25 13:06:02 miod Exp $ */ /* * Copyright (c) 2006 Dale Rahn @@ -93,8 +93,7 @@ ENTRY(_dl_start) addl #DL_DATA_SIZE, %sp | restore sp moveal %d0, %a0 - clrl %d1 - moveal %d1, %a1 | cleanup as expected by CSU + lea %pc@(_dl_dtors),%a1 | cleanup jmp (%a0) rts diff --git a/libexec/ld.so/m88k/ldasm.S b/libexec/ld.so/m88k/ldasm.S index dcee52e6d0c..8609aa7bbd9 100644 --- a/libexec/ld.so/m88k/ldasm.S +++ b/libexec/ld.so/m88k/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.7 2013/08/13 05:52:20 guenther Exp $ */ +/* $OpenBSD: ldasm.S,v 1.8 2013/12/25 13:06:02 miod Exp $ */ /* * Copyright (c) 2013 Miodrag Vallat. @@ -91,8 +91,11 @@ ENTRY(_dl_start) addu %r2, %r30, 4 | argv addu %r31, %r31, DL_DATA_SIZE + bsr 1f | the following instruction is skipped + bcnd eq0, %r0, _dl_dtors | but gives us the pc-relative offset +1: ld.hu %r5, %r1, 2 | fetch branch offset (low 16 bits) jmp.n %r2 - or %r5, %r0, %r0 | cleanup as expected by CSU + lda %r5, %r1[%r5] | cleanup END(_dl_start) /* -- 2.20.1