Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

386 and 486 binaries observation



It probably doesn't have anything to do with the x in x86.  There
are several binary formats under Unix -- ZMAGIC and QMAGIC among
them.  I don't remember the differences off the top of my head, and
I don't have the manual page for the a.out format on my machine here.
One of the differences in binary formats is this:

    An a.out binary file looks like this:
    	+----------------------+
    	|   A header, called   |
    	|   the magic header   |
    	+----------------------+
    	|  The binary image of |
    	| the instructions of  |
    	| your program.  This  |
    	| is called the text   |
    	| segment.             |
    	+----------------------+
    	| The binary image of  |
    	| initialized data     |
    	+----------------------+
    	| A sequence of text   |
    	| segment relocation   |
    	| records              |
    	+----------------------+
    	| A sequence of data   |
    	| segment relocation   |
    	| records              |
    	+----------------------+
    	| A table of strings,  |
    	| which holds the names|
    	| of internal and ex-  |
    	| ternal symbols.      |
    	+----------------------+

The magic header has several 32 bit numbers.  The first is the magic
number, which tells what format the file has.  (QMAGIC and ZMAGIC are
among these.)  The others are the sizes of the text and data segments,
and the sizes of the relocation records.  Look in 
/usr/include/linux/a.out.h for a cryptic but precise definition.  The
problem is: what happens if you want to demand load the text segment.
The first byte of the text segment is not on a page boundary.  It's
after the magic header, which is only 32 or so bytes.  The original
a.out format (NMAGIC?) saved an entire page for the magic header,
and put the text segment on page 2 of the binary file.  With 512
byte pages this is not so terrible, but with 8K pages, that wastes
8k bytes per executable.  Another binary format (ZMAGIC?) added the
magic header as the first few bytes of the first page of text
segment.  This uses a small bit of text segment, but saves multiple
megabytes of space in the file system.

As an aside, I believe OMAGIC is for files in which the text segment
is not sharable.  There are others, but I don't know what they are for.

I don't believe there is a way to convert between them, but you could
try to recompile your kernel to understand both formats.  It's surprising
that it doesn't support the newer format already, however.  Presumably
the executables you get now are newer format.  Perhaps you could just
get a newer kernel -- one with boty NMAGIC and ZMAGIC support.

Hope this helps.  I don't want to discourage you from buying a faster
computer.  If this is the excuse you need, don't let me stand in your
way, but I wouldn't think this should stop you from running whatever you
want, albeit slowly.

					Peace,
					Bill White




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org