From f26ff3c14ed07d77734e7801666e90b95d0ebdd5 Mon Sep 17 00:00:00 2001 From: guenther Date: Sun, 7 Aug 2016 03:01:53 +0000 Subject: [PATCH] Teach mips64 to pass &_DYNAMIC to _dl_boot_bind() mips64be testing by deraadt@ --- libexec/ld.so/boot.c | 4 ++-- libexec/ld.so/mips64/ldasm.S | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libexec/ld.so/boot.c b/libexec/ld.so/boot.c index 3216bdffcc3..5adc7c13b99 100644 --- a/libexec/ld.so/boot.c +++ b/libexec/ld.so/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.9 2016/08/07 02:59:27 guenther Exp $ */ +/* $OpenBSD: boot.c,v 1.10 2016/08/07 03:01:53 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -129,7 +129,7 @@ _dl_boot_bind(const long sp, long *dl_data, Elf_Dyn *dynamicp) #if defined(__alpha__) dynp = (Elf_Dyn *)((long)_DYNAMIC); -#elif defined(__arm__) || defined(__i386__) || defined(__mips64__) +#elif defined(__arm__) || defined(__i386__) dynp = (Elf_Dyn *)((long)_DYNAMIC + loff); #else dynp = dynamicp; diff --git a/libexec/ld.so/mips64/ldasm.S b/libexec/ld.so/mips64/ldasm.S index a3172abfb03..fa5e9eb7b58 100644 --- a/libexec/ld.so/mips64/ldasm.S +++ b/libexec/ld.so/mips64/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.19 2016/05/07 19:05:23 guenther Exp $ */ +/* $OpenBSD: ldasm.S,v 1.20 2016/08/07 03:01:53 guenther Exp $ */ /* * Copyright (c) 1998-2002 Opsycon AB, Sweden. @@ -55,6 +55,8 @@ LEAF(_dl_start, FRAMESZ) /* Not really LEAF, but we simplify */ PTR_ADDU a0, sp, FRAMESZ # Where stack info is. PTR_ADDU a1, sp, 0 # Where fast AUX info will be. + LA a2, _DYNAMIC + PTR_ADDU a2, s0 # Where _DYNAMIC is LA t9, _dl_boot_bind PTR_ADDU t9, s0 jalr t9 # Relocate ourself. -- 2.20.1