1991-05-19 17:26:27 +02:00
|
|
|
|
|
|
|
/********************** FILE HEADER **********************/
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
struct external_filehdr {
|
|
|
|
char f_magic[2]; /* magic number */
|
|
|
|
char f_nscns[2]; /* number of sections */
|
|
|
|
char f_timdat[4]; /* time & date stamp */
|
|
|
|
char f_symptr[4]; /* file pointer to symtab */
|
|
|
|
char f_nsyms[4]; /* number of symtab entries */
|
|
|
|
char f_opthdr[2]; /* sizeof(optional hdr) */
|
|
|
|
char f_flags[2]; /* flags */
|
1991-05-19 17:26:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
/* Mips magics */
|
|
|
|
#define MIPS_MAGIC_1 0x0180
|
|
|
|
#define MIPS_MAGIC_2 0x0162
|
|
|
|
#define MIPS_MAGIC_3 0x0160
|
1991-05-19 17:26:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
#define ECOFFBADMAG(x) (((x).f_magic!=MIPS_MAGIC_1) && \
|
|
|
|
((x).f_magic!=MIPS_MAGIC_2) &&\
|
|
|
|
((x).f_magic!=MIPS_MAGIC_3))
|
1991-05-19 17:26:27 +02:00
|
|
|
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
#define FILHDR struct external_filehdr
|
|
|
|
#define FILHSZ 20
|
1991-05-19 17:26:27 +02:00
|
|
|
|
|
|
|
/********************** AOUT "OPTIONAL HEADER" **********************/
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
|
1991-07-09 02:34:45 +02:00
|
|
|
typedef struct external_aouthdr
|
1991-06-14 22:48:29 +02:00
|
|
|
{
|
|
|
|
char magic[2]; /* type of file */
|
|
|
|
char vstamp[2]; /* version stamp */
|
|
|
|
char tsize[4]; /* text size in bytes, padded to FW bdry*/
|
|
|
|
char dsize[4]; /* initialized data " " */
|
|
|
|
char bsize[4]; /* uninitialized data " " */
|
|
|
|
char entry[4]; /* entry pt. */
|
|
|
|
char text_start[4]; /* base of text used for this file */
|
|
|
|
char data_start[4]; /* base of data used for this file */
|
1991-05-19 17:26:27 +02:00
|
|
|
} AOUTHDR;
|
|
|
|
|
|
|
|
/* return a pointer to the tag bits array */
|
|
|
|
|
|
|
|
#define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
|
|
|
|
|
|
|
|
/* compute size of a header */
|
|
|
|
|
|
|
|
/*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
|
|
|
|
#define AOUTSZ (sizeof(AOUTHDR))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
/********************** SECTION HEADER **********************/
|
1991-05-19 17:26:27 +02:00
|
|
|
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
struct external_scnhdr {
|
|
|
|
char s_name[8]; /* section name */
|
|
|
|
char s_paddr[4]; /* physical address, aliased s_nlib */
|
|
|
|
char s_vaddr[4]; /* virtual address */
|
|
|
|
char s_size[4]; /* section size */
|
|
|
|
char s_scnptr[4]; /* file ptr to raw data for section */
|
|
|
|
char s_relptr[4]; /* file ptr to relocation */
|
|
|
|
char s_lnnoptr[4]; /* file ptr to line numbers */
|
|
|
|
char s_nreloc[2]; /* number of relocation entries */
|
|
|
|
char s_nlnno[2]; /* number of line number entries*/
|
|
|
|
char s_flags[4]; /* flags */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SCNHDR struct external_scnhdr
|
1991-05-19 17:26:27 +02:00
|
|
|
#define SCNHSZ sizeof(SCNHDR)
|
|
|
|
|
|
|
|
|
|
|
|
/********************** LINE NUMBERS **********************/
|
|
|
|
|
|
|
|
/* 1 line number entry for every "breakpointable" source line in a section.
|
|
|
|
* Line numbers are grouped on a per function basis; first entry in a function
|
|
|
|
* grouping will have l_lnno = 0 and in place of physical address will be the
|
|
|
|
* symbol table index of the function name.
|
|
|
|
*/
|
1991-06-14 22:48:29 +02:00
|
|
|
struct external_lineno {
|
1991-05-19 17:26:27 +02:00
|
|
|
union {
|
1991-06-14 22:48:29 +02:00
|
|
|
char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
|
|
|
|
char l_paddr[4]; /* (physical) address of line number */
|
1991-05-19 17:26:27 +02:00
|
|
|
} l_addr;
|
1991-06-14 22:48:29 +02:00
|
|
|
char l_lnno[2]; /* line number */
|
1991-05-19 17:26:27 +02:00
|
|
|
char padding[2]; /* force alignment */
|
|
|
|
};
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
|
|
|
|
#define LINENO struct external_lineno
|
|
|
|
#define LINESZ 8
|
1991-05-19 17:26:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
/********************** SYMBOLS **********************/
|
|
|
|
|
|
|
|
#define SYMNMLEN 8 /* # characters in a symbol name */
|
|
|
|
#define FILNMLEN 14 /* # characters in a file name */
|
|
|
|
#define DIMNUM 4 /* # array dimensions in auxiliary entry */
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
struct external_syment
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
char e_name[SYMNMLEN];
|
|
|
|
struct {
|
|
|
|
char e_zeroes[4];
|
|
|
|
char e_offset[4];
|
|
|
|
} e;
|
|
|
|
} e;
|
|
|
|
char e_value[4];
|
|
|
|
char e_scnum[2];
|
|
|
|
char e_flags[2];
|
|
|
|
char e_type[4];
|
|
|
|
char e_sclass[1];
|
|
|
|
char e_numaux[1];
|
|
|
|
char pad2[2];
|
1991-05-19 17:26:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define N_BTMASK (0x1f)
|
|
|
|
#define N_TMASK (0x60)
|
|
|
|
#define N_BTSHFT (5)
|
|
|
|
#define N_TSHIFT (2)
|
1991-06-14 22:48:29 +02:00
|
|
|
union external_auxent {
|
1991-05-19 17:26:27 +02:00
|
|
|
struct {
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_tagndx[4]; /* str, un, or enum tag indx */
|
1991-05-19 17:26:27 +02:00
|
|
|
union {
|
|
|
|
struct {
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_lnno[2]; /* declaration line number */
|
|
|
|
char x_size[2]; /* str/union/array size */
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_lnsz;
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_fsize[4]; /* size of function */
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_misc;
|
|
|
|
union {
|
|
|
|
struct { /* if ISFCN, tag, or .bb */
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_lnnoptr[4]; /* ptr to fcn line # */
|
|
|
|
char x_endndx[4]; /* entry ndx past block end */
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_fcn;
|
|
|
|
struct { /* if ISARY, up to 4 dimen. */
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_dimen[DIMNUM][2];
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_ary;
|
|
|
|
} x_fcnary;
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_tvndx[2]; /* tv index */
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_sym;
|
|
|
|
|
|
|
|
union {
|
|
|
|
char x_fname[FILNMLEN];
|
|
|
|
struct {
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_zeroes[4];
|
|
|
|
char x_offset[4];
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_n;
|
|
|
|
} x_file;
|
|
|
|
|
|
|
|
struct {
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_scnlen[4]; /* section length */
|
|
|
|
char x_nreloc[2]; /* # relocation entries */
|
|
|
|
char x_nlinno[2]; /* # line numbers */
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_scn;
|
|
|
|
|
|
|
|
struct {
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_tvfill[4]; /* tv fill value */
|
|
|
|
char x_tvlen[2]; /* length of .tv */
|
|
|
|
char x_tvran[2][2]; /* tv range */
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
|
|
|
|
|
|
|
|
/******************************************
|
|
|
|
* I960-specific *2nd* aux. entry formats
|
|
|
|
******************************************/
|
|
|
|
struct {
|
1991-06-14 22:48:29 +02:00
|
|
|
/* This is a very old typo that keeps getting propagated. */
|
1991-05-19 17:26:27 +02:00
|
|
|
#define x_stdindx x_stindx
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_stindx[4]; /* sys. table entry */
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_sc; /* system call entry */
|
|
|
|
|
|
|
|
struct {
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_balntry[4]; /* BAL entry point */
|
1991-05-19 17:26:27 +02:00
|
|
|
} x_bal; /* BAL-callable function */
|
|
|
|
|
|
|
|
struct {
|
1991-06-14 22:48:29 +02:00
|
|
|
char x_timestamp[4]; /* time stamp */
|
1991-05-19 17:26:27 +02:00
|
|
|
char x_idstring[20]; /* producer identity string */
|
|
|
|
} x_ident; /* Producer ident info */
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
|
|
|
|
#define SYMENT struct external_syment
|
|
|
|
#define SYMESZ sizeof(SYMENT) /* FIXME - calc by hand */
|
|
|
|
#define AUXENT union external_auxent
|
|
|
|
#define AUXESZ sizeof(AUXENT) /* FIXME - calc by hand */
|
|
|
|
|
1991-05-19 17:26:27 +02:00
|
|
|
# define _ETEXT "_etext"
|
|
|
|
|
|
|
|
/********************** RELOCATION DIRECTIVES **********************/
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
struct external_reloc {
|
|
|
|
char r_vaddr[4];
|
|
|
|
char r_symndx[4];
|
|
|
|
char r_type[2];
|
|
|
|
char pad[2];
|
1991-05-19 17:26:27 +02:00
|
|
|
};
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
|
1991-05-19 17:26:27 +02:00
|
|
|
/* Relevent values for r_type and i960. Would someone please document them */
|
|
|
|
|
1991-06-14 22:48:29 +02:00
|
|
|
|
|
|
|
#define RELOC struct external_reloc
|
|
|
|
#define RELSZ 12
|
1991-05-19 17:26:27 +02:00
|
|
|
|
|
|
|
#define DEFAULT_DATA_SECTION_ALIGNMENT 4
|
|
|
|
#define DEFAULT_BSS_SECTION_ALIGNMENT 4
|
|
|
|
#define DEFAULT_TEXT_SECTION_ALIGNMENT 16
|
|
|
|
/* For new sections we havn't heard of before */
|
|
|
|
#define DEFAULT_SECTION_ALIGNMENT 4
|