From 712997c7d8afe122dd58793cc4fc8133c1fb2195 Mon Sep 17 00:00:00 2001 From: guenther Date: Sun, 7 Aug 2016 02:30:55 +0000 Subject: [PATCH] Teach i386 to pass &_DYNAMIC to _dl_boot_bind() --- lib/csu/boot.h | 4 ++-- lib/csu/i386/md_init.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/csu/boot.h b/lib/csu/boot.h index da699efb6d2..88aee9556af 100644 --- a/lib/csu/boot.h +++ b/lib/csu/boot.h @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.h,v 1.18 2016/08/07 02:30:04 guenther Exp $ */ +/* $OpenBSD: boot.h,v 1.19 2016/08/07 02:30:55 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -148,7 +148,7 @@ _dl_boot_bind(const long sp, long *dl_data, Elf_Dyn *dynamicp) #if defined(__alpha__) dynp = (Elf_Dyn *)((long)_DYNAMIC); -#elif defined(__i386__) || defined(__mips64__) +#elif defined(__mips64__) dynp = (Elf_Dyn *)((long)_DYNAMIC + loff); #else dynp = dynamicp; diff --git a/lib/csu/i386/md_init.h b/lib/csu/i386/md_init.h index 33fc12cc6ae..a7fba833de6 100644 --- a/lib/csu/i386/md_init.h +++ b/lib/csu/i386/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.7 2016/03/20 02:32:39 guenther Exp $ */ +/* $OpenBSD: md_init.h,v 1.8 2016/08/07 02:30:55 guenther Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -95,7 +95,8 @@ "__start: \n" \ " movl %esp,%eax # save SP for dl_boot_bind \n" \ " subl $16*4,%esp # allocate dl_data \n" \ - " pushl $0 # push 0 for dynamicp (unused on i386) \n" \ + " call 1f # push &_DYNAMIC... \n" \ + "1: addl $(_DYNAMIC-1b),(%esp) # ...for dl_boot_bind \n" \ " movl %esp,%ebx \n" \ " pushl %ebx # push dl_data for dl_boot_bind \n" \ " \n" \ -- 2.20.1