[comp.sys.atari.st] Anyone know the format of a TOS executable's header?

timcc@csv.viccol.edu.au (Tim Cook) (01/09/90)

I am trying to write a program to dump the header information in a TOS
executable, but have come across a problem.

I have two sources of information on the contents of this header, and they
conflict.

Source 1 says:

1> /*	GEMDOS executable file format
1> */
1>
1> /*  CP/M-68K header
1> */
1> typedef struct {
1>     int        c_magic;    /* magic number (0x601A)       */
1>     long       c_text;     /* size of text segment        */
1>     long       c_data;     /* size of initialized data    */
1>     long       c_bss;      /* size of uninitialized data  */
1>     long       c_syms;     /* size of symbol table        */
1>     long       c_entry;    /* entry point                 */
1>     long       c_res;      /* reserved, always zero       */
1>     int        c_reloc;    /* size of data relocation     */
1>     } header;

while source 2 says:

2> /*
2>  * output format for Alcyon 68K compiler
2>  */
2>
2> struct head {
2> 	short 	a_magic;	/* a.out magic number */
2> 	long	a_tsize;	/* # bytes in program text segment */
2> 	long	a_dsize;	/* # bytes in program data segment */
2> 	long	a_bsize;	/* # bytes in program bss  segment */
2> 	long	a_ssize;	/* # bytes in symbol table */
2> 	long	a_stksize;	/* initial stack size */
2> 	long	a_entry;	/* entry point */
2> 	short	a_rlbflg;	/* relocation bits suppressed flag */
2> };
2>
2> struct more {
2> 	long	a_dstart;	/* address of data segment */
2> 	long	a_bstart;	/* address of bss segment */
2> };
2>
2> #define A_MAGICA	0x601A	/* contiguous file with short format */
2> #define A_MAGICB	0x601B	/* noncontiguous file, 'more' added */
2> #define A_MAGICC	0x601C	/* as MAGICA, but data aligned on 2k */
2> #define A_MAGICD	0x601D	/* as MAGICA, but data starts on 0 */
2> #define A_MAGICE	0x601E	/* as MAGICA, but data aligned on 4k */

Does anyone know which is correct, or is there anything not covered by
either?  I would also like to know the function of the a_rlbflg field,
mentioned by source 1.  Surely this information is not "TOP SECRET
HAND-KISSING DEVELOPERS ONLY" information?  (Add :-) as required.)

(For all the Kopyright Kops out there: keep your hair on; the above
information was not accompanied by copyright notices in any form.)

--
Tim Cook     Systems Administrator, Victoria College Computer Services

parrot - n.  An animal that has the ability to imitate man, but not the
             intelligence to refrain from doing so.