struct filehdr {
	unsigned short	f_magic;	/* magic number */
					/* Target machine on which the
					   object file is executable */
	unsigned short	f_nscns;	/* number of sections */
	long		f_timdat;	/* time & date stamp */
	long		f_symptr;	/* file pointer to symtab */
	long		f_nsyms;	/* number of symtab entries */
	unsigned short	f_opthdr;	/* sizeof(optional hdr) */
	unsigned short	f_flags;	/* flags */
};

typedef struct aouthdr {
	short	magic;		/* flags - how to execute		*/
			/* 0x0107 text & data contiguous, both writable */
			/* 0x0108 text is R/O, data in next section	*/
			/* 0x010B text & data aligned and may be paged	*/
	short	vstamp;		/* version stamp			*/
	long	tsize;		/* text size in bytes, padded to FW bdry*/
	long	dsize;		/* initialized data " "			*/
	long	bsize;		/* uninitialized data " "		*/
#if u3b
	long	dum1;
	long	dum2;		/* pad to entry point	*/
#endif
	long	entry;		/* entry pt.				*/
	ulong	text_start;	/* base of text used for this file	*/
	ulong	data_start;	/* base of data used for this file	*/
	ulong	o_toc;		/* address of TOC			*/
	short	o_snentry;	/* section number for entry point	*/
	short	o_sntext;	/* section number for text		*/
	short	o_sndata;	/* section number for data		*/
	short	o_sntoc;	/* section number for toc		*/
	short	o_snloader;	/* section number for loader section	*/
	short	o_snbss;	/* section number for bss		*/
	short	o_algntext;	/* max alignment for text		*/
	short	o_algndata;	/* max alignment for data		*/
	char	o_modtype[2];	/* Module type field, 1R,RE,RO		*/
	char	o_resv1[2];	/* reserved field			*/
	ulong	o_maxstack;	/* max stack size allowed.		*/
	ulong	o_resv2[4];	/* reserved fields			*/
} AOUTHDR;




sections

raw data
relocation
line number
symbol table
string table


int ldnshread (ldPointer, SectionName, SectionHead)
LDFILE *ldPointer;
char *SectionName;
SCNHDR *SectionHead;





struct scnhdr {
	char	s_name[8];	/* section name */
	ulong	s_paddr;	/* physical address */
	ulong	s_vaddr;	/* virtual address */
	ulong	s_size;		/* section size */
	long	s_scnptr;	/* file ptr to raw data for section */
	long	s_relptr;	/* file ptr to relocation */
	long	s_lnnoptr;	/* file ptr to line numbers */
	ushort	s_nreloc;	/* number of relocation entries */
	ushort	s_nlnno;	/* number of line number entries */
	long	s_flags;	/* flags */
};
