Subject: Re: Linux ELF binaries won't run
To: Richard Pennington <rich@rdp.introl.com>
From: Frank van der Linden <frank@fwi.uva.nl>
List: port-i386
Date: 11/16/1996 20:21:52
Quoting Richard Pennington,

> Has something changed in -current within the last two weeks that would cause
> the Linux emulation to break?

Yes, the latest change to the exec_elf32 code breaks thing. If you want
to get things working before this is sorted out and fixed, revert
to the previous version, by applying the following patch with
'patch -R' (sorry, I had the diff lying around reversed ;-))


Index: exec_elf32.c
===================================================================
RCS file: /a/cvsroot/src/sys/kern/exec_elf32.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -c -r1.19 -r1.20
*** exec_elf32.c	1996/10/13 22:54:52	1.19
--- exec_elf32.c	1996/11/11 20:33:10	1.20
***************
*** 1,4 ****
! /*	$NetBSD: exec_elf32.c,v 1.19 1996/10/13 22:54:52 cgd Exp $	*/
  
  /*
   * Copyright (c) 1996 Christopher G. Demetriou
--- 1,4 ----
! /*	$NetBSD: exec_elf32.c,v 1.20 1996/11/11 20:33:10 jonathan Exp $	*/
  
  /*
   * Copyright (c) 1996 Christopher G. Demetriou
***************
*** 413,419 ****
  			/* If entry is within this section it must be text */
  			if (eh.e_entry >= ph[i].p_vaddr &&
  			    eh.e_entry < (ph[i].p_vaddr + size)) {
! 				*entry = addr + eh.e_entry;
  				ap->arg_interp = addr;
  			}
  			addr += size;
--- 413,419 ----
  			/* If entry is within this section it must be text */
  			if (eh.e_entry >= ph[i].p_vaddr &&
  			    eh.e_entry < (ph[i].p_vaddr + size)) {
! 				*entry = addr + eh.e_entry - ph[i].p_vaddr;
  				ap->arg_interp = addr;
  			}
  			addr += size;
***************
*** 612,617 ****
--- 612,619 ----
  		}
  	}
  
+ 	/* this breaks on, e.g., OpenBSD-compatible mips shared binaries. */
+ #ifndef ELF_INTERP_NON_RELOCATABLE
  	/*
  	 * If no position to load the interpreter was set by a probe
  	 * function, pick the same address that a non-fixed mmap(0, ..)
***************
*** 620,625 ****
--- 622,628 ----
  	if (pos == ELFDEFNNAME(NO_ADDR) &&
  	    epp->ep_emul == &ELFNAMEEND(emul_netbsd))
  		pos = round_page(epp->ep_daddr + MAXDSIZ);
+ #endif	/* !ELF_INTERP_NON_RELOCATABLE */
  
  	/*
  	 * Check if we found a dynamically linked binary and arrange to load