From 45f3b7e734fc155ce84bb13c5260e10022f5958f Mon Sep 17 00:00:00 2001 From: guenther Date: Tue, 9 Aug 2016 03:58:35 +0000 Subject: [PATCH] Teach arm to pass &_DYNAMIC to _dl_boot_bind(); can optimize later in tree --- libexec/ld.so/arm/ldasm.S | 15 ++++++++++----- libexec/ld.so/boot.c | 7 +------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libexec/ld.so/arm/ldasm.S b/libexec/ld.so/arm/ldasm.S index 80365b9b9c8..04e445b6ac1 100644 --- a/libexec/ld.so/arm/ldasm.S +++ b/libexec/ld.so/arm/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.22 2016/05/07 19:05:23 guenther Exp $ */ +/* $OpenBSD: ldasm.S,v 1.23 2016/08/09 03:58:35 guenther Exp $ */ /* * Copyright (c) 2004 Dale Rahn @@ -41,6 +41,12 @@ ENTRY(_dl_start) mov r0, fp @ original stack mov r1, r7 @ dl_data + ldr r8, .L_GOT @ calculate address of GOT... +1: add r8, pc, r8 @ into r8 + + ldr r2, .L__DYNAMIC @ &_DYNAMIC + add r2, r2, r8 + bl _dl_boot_bind add r0, r5, #4 @ argv @@ -56,14 +62,13 @@ ENTRY(_dl_start) mov lr, r6 mov r1, r0 - ldr r2, .L_GOT -1: - add r2, pc, r2 ldr r0, .L_dl_dtors - add r0, r0, r2 + add r0, r0, r8 mov pc, r1 .L_GOT: .long _GLOBAL_OFFSET_TABLE_-(1b+8) +.L__DYNAMIC: + .long _DYNAMIC(GOTOFF) .L_dl_dtors: .long _dl_dtors(GOTOFF) diff --git a/libexec/ld.so/boot.c b/libexec/ld.so/boot.c index b7b34dbeb15..49555117e91 100644 --- a/libexec/ld.so/boot.c +++ b/libexec/ld.so/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.12 2016/08/07 03:05:23 guenther Exp $ */ +/* $OpenBSD: boot.c,v 1.13 2016/08/09 03:58:35 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -126,12 +126,7 @@ _dl_boot_bind(const long sp, long *dl_data, Elf_Dyn *dynamicp) * Scan the DYNAMIC section for the loader. * Cache the data for easier access. */ - -#if defined(__arm__) - dynp = (Elf_Dyn *)((long)_DYNAMIC + loff); -#else dynp = dynamicp; -#endif _dl_memset(&dynld, 0, sizeof(dynld)); while (dynp->d_tag != DT_NULL) { -- 2.20.1