Subject: Re: QMAGIC vs ZMAGIC
To: Andrew Cagney <cagney@highland.oz.au>
From: Chris G. Demetriou <cgd@alpha.bostic.com>
List: tech-kern
Date: 06/19/1994 18:55:17
> What's the history (for NetBSD) for these?
basically:
there are two types of i386 executables: "old" and "new".
New have a non-zero "machine ID" field in the header,
and the a_magic and a_mid fields are combined into one,
which is in network byte order.
There are several wins to this, most notably the fact that
you can easily tell different architectures' binaries apart --
previously, all little-endian architectures' binaries looked
the same, from pdp-11 until now!
> I ask as for NetBSD, the header is in the first page of text (sounding
> like a QMAGIC file) yet the magic number for the executable is set to
> ZMAGIC.
right. broken down into old/new:
old:
ZMAGIC: header not in first page, load at zero
QMAGIC: header in first page, load at NBPG (or one of
those constants... 8-)
new:
ZMAGIC: like old QMAGIC, except named ZMAGIC, and
with the other changes noted above
QMAGIC: doesn't exist.
For example, Sun binaries which are 'ZMAGIC' have loaded
in the "old QMAGIC style" for a long, long time. (the QMAGIC
name/number was an invention of BSDI, to help them find kernel
bugs...) Anyway, since the "don't load at zero, have header in
text" is superior, and since the "standard" executable format
for UN*X systems is "supposed to be" named ZMAGIC, when
we went to the new (network byte order ID fields) format,
we also changed the magic numbering around.
-current NetBSD/i386 can run all of the old binary formats,
including those used by 386BSD (except for jolitz's "screwballmode"
binaries, which were used on his install disks, i guess).
chris
------------------------------------------------------------------------------