From 4a2c0be6fd4c6f96d4e62635b17b27e853351f37 Mon Sep 17 00:00:00 2001 From: jdp Date: Fri, 19 Feb 1999 01:30:43 +0000 Subject: [PATCH] On the i386, load the ELF dynamic linker where an mmap(0, ...) would put it, just like on the Alpha. It was wrong to load it at the fixed address 0x08000000. That should only be done if the dynamic linker is an executable (not a shared object) with a specific load address encoded in the object file itself. This fixes the recent breakage in the Linux emulator. --- sys/amd64/include/elf.h | 12 +++++++----- sys/i386/include/elf.h | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sys/amd64/include/elf.h b/sys/amd64/include/elf.h index c6bedaf8e306..ac0cce3ee0e9 100644 --- a/sys/amd64/include/elf.h +++ b/sys/amd64/include/elf.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elf.h,v 1.5 1998/10/18 15:31:23 peter Exp $ + * $Id: elf.h,v 1.6 1999/02/07 23:49:55 jdp Exp $ */ #ifndef _MACHINE_ELF_H_ @@ -121,11 +121,13 @@ __ElfType(Auxinfo); #ifdef KERNEL /* - * On the i386 we load the dynamic linker at a fixed address, - * below where the executable itself is loaded. This is the - * standard SVR4 location for it. + * On the i386 we load the dynamic linker where a userland call + * to mmap(0, ...) would put it. The rationale behind this + * calculation is that it leaves room for the heap to grow to + * its maximum allowed size. */ -#define ELF_RTLD_ADDR(vmspace) 0x08000000 +#define ELF_RTLD_ADDR(vmspace) \ + (round_page((vm_offset_t)(vmspace)->vm_daddr + MAXDSIZ)) #endif /* KERNEL */ #endif /* !_MACHINE_ELF_H_ */ diff --git a/sys/i386/include/elf.h b/sys/i386/include/elf.h index c6bedaf8e306..ac0cce3ee0e9 100644 --- a/sys/i386/include/elf.h +++ b/sys/i386/include/elf.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elf.h,v 1.5 1998/10/18 15:31:23 peter Exp $ + * $Id: elf.h,v 1.6 1999/02/07 23:49:55 jdp Exp $ */ #ifndef _MACHINE_ELF_H_ @@ -121,11 +121,13 @@ __ElfType(Auxinfo); #ifdef KERNEL /* - * On the i386 we load the dynamic linker at a fixed address, - * below where the executable itself is loaded. This is the - * standard SVR4 location for it. + * On the i386 we load the dynamic linker where a userland call + * to mmap(0, ...) would put it. The rationale behind this + * calculation is that it leaves room for the heap to grow to + * its maximum allowed size. */ -#define ELF_RTLD_ADDR(vmspace) 0x08000000 +#define ELF_RTLD_ADDR(vmspace) \ + (round_page((vm_offset_t)(vmspace)->vm_daddr + MAXDSIZ)) #endif /* KERNEL */ #endif /* !_MACHINE_ELF_H_ */