Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Nov 1999 09:58:10 +0100
From:      Marcel Moolenaar <marcel@scc.nl>
To:        emulation@FreeBSD.org
Subject:   Re: unbranded, static linux binaries
Message-ID:  <382FCB22.BED6D32E@scc.nl>
References:  <199911150151.UAA01121@dreamscape.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Mark W. Krentel" wrote:
> 
> I think the linux emulation has a problem with linux binaries that are
> unbranded and compiled statically.  They run, but only after being
> branded type Linux.  Unbranded, I get "ELF binary type not known."

It's actually not the Linuxulator that has the problem. When the kernel
loads a binary (say, your a.out "Hello, world" program) it has to figure
out what kind of binary it is (eg what ABI). When the binary was linked
dynamicly, the kernel uses the information about the dynamic linker to
find that out, but static binaries don't have that. There's basicly
nothing in a static binary (other than the branding) that tells the
kernel if it's FreeBSD, Linux, SCO etc etc.

Static FreeBSD binaries have a branding, but static Linux binaries not.
So, the kernel (being safe) tells you that. In -current there's a
default branding, which means that if a static binary doesn't have a
branding, it is assumed to be equal to the default branding. I good
feature when used with care! On -stable you simply have to brand the
binary first.

>   % file a.out
>   a.out: ELF 32-bit LSB executable, Intel 80386, version 1,
>   statically linked, not stripped
[snip]
>   % brandelf -t Linux a.out

Doing ``file a.out'' after branding would give you something like:
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (Linux),
statically linked, stripped

-- 
Marcel Moolenaar                        mailto:marcel@scc.nl
SCC Internetworking & Databases           http://www.scc.nl/
The FreeBSD project                mailto:marcel@FreeBSD.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?382FCB22.BED6D32E>