Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

a.out format in Minix3?

10 views
Skip to first unread message

Alex

unread,
Jun 17, 2006, 6:10:14 AM6/17/06
to
Hi,

I was looking for description of a.out format in Minix3. I've found no
man page. One old posting regarding this issue came up -
<http://listserv.nodak.edu/cgi-bin/wa.exe?A2=ind9310E&L=MINIX-L&P=R2&I=-3>,
by Michael Haardt, titled "[Summary] Re: Questions about a.out format"
- but it's rather sketchy and from 1993.

Are there any sources for information regarding a.out format in Minix3?
If not, what relevant information you'd recommend, in addition to
a.out.h?

Thanks,

Alex

Christos Karayiannis

unread,
Jun 17, 2006, 1:13:07 PM6/17/06
to
To find some rudimentary info on the a.out header format use the dis386
disassembler as:


cc -o file file.o

diso -h file.o

for the object file file.o

and also

dise -h file

for the executable (a.out) file.


Christos


awoo...@hampshire.edu

unread,
Jun 17, 2006, 3:15:58 PM6/17/06
to
Alex <Alexander...@gmail.com> wrote:

I think there should be an a.out(5) man page, and Michael Haardt's
1993 posting to which you refer is obviously meant to serve this
function. Somehow it must have escaped the attention of the Minix
maintainers in Amsterdam and was never incorporated into a Minix
release. I will put updating this on my list of projects and I will
try to get it included in a future Minix release.

Despite its age, Haardt's 1993 post is still an accurate description
of the a.out structure. I compared it with /usr/include/a.out.h in
Minix 2.0.0 and with /usr/src/include/a.out.h in Minix 3.1.0, and the
structures are identical. A few field names have been changed
slightly, and new possible values for flags and CPU types have been
added, but the basic structure is the same.

The first OSDI edition, which describes Minix 1, doesn't list an
a.out.h file, but the structure of a file header is described in
comments in the file mm/exec.c beginning at line 6046, and this looks
identical to the current structure.

In fact, this should not be a surprise, the a.out structure is not a
Minix invention, it's a Unix thing. Although the famous Lions'
Commentary on Unix 6th Edition from 1977 doesn't list an a.out.h
file, the code for exec.c listed by Lions shows that a similar
structure was used for file headers. See, for instance, comments
starting at line 3076.

Quite a while ago somebody wrote a short C program called dos2out.c
that would convert a file compiled under MS-DOS to the a.out
format. This is from the early days when cross-compiling for Minix was
useful. The a.out structure described in this program is the same as
the current one. The program was apparently first written in 1985
(before Minix 1.0 was released) although the version I have seems to
date from 1997. A description and the C source of this program are on
my website, see http://minix1.woodhull.com/pub/contrib/dos2out.txt and
http://minix1.woodhull.com/pub/contrib/dos2out.c.

--
+----------------------------------+
| Albert S. Woodhull |
| awoo...@hampshire.edu |
| http://minix1.woodhull.com/asw/ |
+----------------------------------+
The idea is to die young as late as possible.

Philip Homburg

unread,
Jun 17, 2006, 6:10:34 PM6/17/06
to
In article <e01em3-...@wonka.hampshire.edu>,

<awoo...@hampshire.edu> wrote:
>In fact, this should not be a surprise, the a.out structure is not a
>Minix invention, it's a Unix thing. Although the famous Lions'
>Commentary on Unix 6th Edition from 1977 doesn't list an a.out.h
>file, the code for exec.c listed by Lions shows that a similar
>structure was used for file headers. See, for instance, comments
>starting at line 3076.

Here is (part of) the v7 a.out.h:
struct exec { /* a.out header */
int a_magic; /* magic number */
unsigned a_text; /* size of text segment */
unsigned a_data; /* size of initialized data */
unsigned a_bss; /* size of unitialized data */
unsigned a_syms; /* size of symbol table */
unsigned a_entry; /* entry point */
unsigned a_unused; /* not used */
unsigned a_flag; /* relocation info stripped */
};

#define A_MAGIC1 0407 /* normal */
#define A_MAGIC2 0410 /* read-only text */
#define A_MAGIC3 0411 /* separated I&D */
#define A_MAGIC4 0405 /* overlay */

And here is part of the 4.3BSD (net2) sys/exec.h:

/* Header prepended to each a.out file. */
struct exec {
#if !defined(vax) && !defined(tahoe) && !defined(i386)
unsigned short a_mid; /* machine ID */
unsigned short a_magic; /* magic number */
#else
long a_magic; /* magic number */
#endif
unsigned long a_text; /* text segment size */
unsigned long a_data; /* initialized data size */
unsigned long a_bss; /* uninitialized data size */
unsigned long a_syms; /* symbol table size */
unsigned long a_entry; /* entry point */
unsigned long a_trsize; /* text relocation size */
unsigned long a_drsize; /* data relocation size */
};
#define a_machtype a_mid /* SUN compatibility */

/* a_magic */
#define OMAGIC 0407 /* old impure format */
#define NMAGIC 0410 /* read-only text */
#define ZMAGIC 0413 /* demand load format */

/* a_mid */
#define MID_ZERO 0 /* unknown - implementation dependent */
#define MID_SUN010 1 /* sun 68010/68020 binary */
#define MID_SUN020 2 /* sun 68020-only binary */
#define MID_HP200 200 /* hp200 (68010) BSD binary */
#define MID_HP300 300 /* hp300 (68020+68881) BSD binary */
#define MID_HPUX 0x20C /* hp200/300 HP-UX binary */
#define MID_HPUX800 0x20B /* hp800 HP-UX binary */

It is obvious that the Minix a.out.h is inspired by other a.out.h structures,
but there are also a few Minix specific additions.

(v6 doesn't seem to have an a.out.h)


--
That was it. Done. The faulty Monk was turned out into the desert where it
could believe what it liked, including the idea that it had been hard done
by. It was allowed to keep its horse, since horses were so cheap to make.
-- Douglas Adams in Dirk Gently's Holistic Detective Agency

ast

unread,
Jun 19, 2006, 10:57:40 AM6/19/06
to
Alex wrote:

> Are there any sources for information regarding a.out format in Minix3?

I added a link to Michael Hardt's posting to the DOCUMENTATION page
under Technical Notes.

Andy Tanenbaum

0 new messages