*BSD News Article 88330


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!munnari.OZ.AU!news.Hawaii.Edu!news.uoregon.edu!arclight.uoregon.edu!nntp.uio.no!news.apfel.de!fu-berlin.de!news.belwue.de!news.uni-mannheim.de!andrew
From: andrew@wipux2.wifo.uni-mannheim.de (Andrew Wheadon)
Newsgroups: comp.unix.bsd.netbsd.misc
Subject: Re: How to make NetBSD-1.2 i386 execute ELF binaries
Date: 2 Feb 1997 16:35:52 GMT
Organization: Rechenzentrum Uni-Mannheim
Lines: 39
Message-ID: <5d2fp8$g3g@trumpet.uni-mannheim.de>
References: <32ED6F29.41C67EA6@oz.net> <5cpkvv$7u4@doom> <5cq98h$cam@trumpet.uni-mannheim.de> <32F378B5.41C67EA6@oz.net>
NNTP-Posting-Host: wipux2.wifo.uni-mannheim.de
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.netbsd.misc:5302

In article <32F378B5.41C67EA6@oz.net>,
Bill&Virginia Hodges  <hodges@oz.net> wrote:
>Andrew Wheadon wrote:
>> They are not mutually exclusive except for ELF binaries so if you
>> leave both of them defined you can run a.out binaries from both
>> linux and svr4, and whichever elf-format gets checked first (Linux
>> as far as I remember) from one or the other system but not both.
Looking at the source I think svr4 gets first go.
>options         COMPAT_SVR4     # binary compatibility with SVR4
>options         COMPAT_LINUX    # binary compatibility with Linux
>
>options         EXEC_ELF32      # To execute linux &SVR4  exectables

>When I execute I get:
>localhost[bin] 67 > file *
>recover:       ELF 32-bit LSB executable, Intel 80386, version 1
>localhost[bin] 68 > recover
>recover: Exec format error. Wrong Architecture.
>localhost[bin] 69 > 
>What am I doing wrong?
You are running a statically linked ELF-i386 binary, since there is no 
way for the kernel to tell which emulation to run (ELF does not define
a way of differing between os's on the same architecture. In this case the 
kernel probe will answer yes-i-run-this on whichever arch (linux/svr4) 
is probed first. It will then try to run it in that mode.

So You have a static Linux ELF binary and are probing SVR4 first.

Solution:
* Use dynamically linked binaries.
* Use a.out binaries
* Change the order of the probe (kern/exec_elf32.c I think.)
  and receive the same error for SVR4 static binaries in future.
* Recompile for NetBSD.
Cheerio
-- 
The cost of living hasn't affected its popularity. (Mark Twain)
current	release=doc host=netbsd.wifo.uni-mannheim.de \ "NetBSD-current mirror"
hostbase=/mit/ftp/pub/NetBSD base=/usr prefix=/usr backup delete use-rel-suffix