1991-04-25 04:20:11 +00:00
|
|
|
/*** coff information for 88k bcs */
|
|
|
|
|
|
|
|
/********************** FILE HEADER **********************/
|
1991-05-11 02:23:48 +00: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-04-25 04:20:11 +00:00
|
|
|
|
|
|
|
#define MC88MAGIC 0540 /* 88k BCS executable */
|
|
|
|
#define MC88DMAGIC 0541 /* DG/UX executable */
|
|
|
|
#define MC88OMAGIC 0555 /* Object file */
|
|
|
|
|
|
|
|
#define MC88BADMAG(x) (((x).f_magic!=MC88MAGIC) &&((x).f_magic!=MC88DMAGIC) && ((x).f_magic != MC88OMAGIC))
|
|
|
|
|
1991-05-11 02:23:48 +00:00
|
|
|
#define FILHDR struct external_filehdr
|
1991-04-25 04:20:11 +00:00
|
|
|
#define FILHSZ sizeof(FILHDR)
|
|
|
|
|
|
|
|
|
|
|
|
/********************** AOUT "OPTIONAL HEADER" **********************/
|
|
|
|
|
|
|
|
|
|
|
|
#define PAGEMAGIC3 0414 /* Split i&d, zero mapped */
|
|
|
|
#define PAGEMAGICBCS 0413
|
|
|
|
|
1991-05-11 02:23:48 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
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 */
|
|
|
|
}
|
|
|
|
AOUTHDR;
|
1991-04-25 04:20:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* compute size of a header */
|
|
|
|
|
|
|
|
#define AOUTSZ (sizeof(AOUTHDR))
|
|
|
|
|
|
|
|
/********************** STORAGE CLASSES **********************/
|
|
|
|
|
|
|
|
#define C_EFCN -1 /* physical end of function */
|
|
|
|
#define C_NULL 0
|
|
|
|
#define C_AUTO 1 /* automatic variable */
|
|
|
|
#define C_EXT 2 /* external symbol */
|
|
|
|
#define C_STAT 3 /* static */
|
|
|
|
#define C_REG 4 /* register variable */
|
|
|
|
#define C_EXTDEF 5 /* external definition */
|
|
|
|
#define C_LABEL 6 /* label */
|
|
|
|
#define C_ULABEL 7 /* undefined label */
|
|
|
|
#define C_MOS 8 /* member of structure */
|
|
|
|
#define C_ARG 9 /* function argument */
|
|
|
|
#define C_STRTAG 10 /* structure tag */
|
|
|
|
#define C_MOU 11 /* member of union */
|
|
|
|
#define C_UNTAG 12 /* union tag */
|
|
|
|
#define C_TPDEF 13 /* type definition */
|
|
|
|
#define C_USTATIC 14 /* undefined static */
|
|
|
|
#define C_ENTAG 15 /* enumeration tag */
|
|
|
|
#define C_MOE 16 /* member of enumeration */
|
|
|
|
#define C_REGPARM 17 /* register parameter */
|
|
|
|
#define C_FIELD 18 /* bit field */
|
|
|
|
#define C_BLOCK 100 /* ".bb" or ".eb" */
|
|
|
|
#define C_FCN 101 /* ".bf" or ".ef" */
|
|
|
|
#define C_EOS 102 /* end of structure */
|
|
|
|
#define C_FILE 103 /* file name */
|
|
|
|
#define C_LINE 104 /* line # reformatted as symbol table entry */
|
|
|
|
#define C_ALIAS 105 /* duplicate tag */
|
|
|
|
#define C_HIDDEN 106 /* ext symbol in dmert public lib */
|
|
|
|
#define C_SHADOW 107 /* shadow symbol */
|
|
|
|
#define C_VERSION 108 /* coff version symbol */
|
|
|
|
|
|
|
|
|
|
|
|
/********************** SECTION HEADER **********************/
|
|
|
|
|
1991-05-11 02:23:48 +00: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[4]; /* number of relocation entries */
|
|
|
|
char s_nlnno[4]; /* number of line number entries*/
|
|
|
|
char s_flags[4]; /* flags */
|
1991-04-25 04:20:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1991-05-11 02:23:48 +00:00
|
|
|
#define SCNHDR struct external_scnhdr
|
1991-04-25 04:20:11 +00:00
|
|
|
#define SCNHSZ sizeof(SCNHDR)
|
|
|
|
|
1991-08-21 04:08:28 +00:00
|
|
|
/*
|
|
|
|
* names of "special" sections
|
|
|
|
*/
|
|
|
|
#define _TEXT ".text"
|
|
|
|
#define _DATA ".data"
|
|
|
|
#define _BSS ".bss"
|
1991-04-25 04:20:11 +00:00
|
|
|
|
|
|
|
/********************** 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-05-10 19:41:19 +00:00
|
|
|
struct external_lineno{
|
|
|
|
union {
|
|
|
|
char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
|
|
|
|
char l_paddr[4]; /* (physical) address of line number */
|
|
|
|
} l_addr;
|
|
|
|
|
|
|
|
char l_lnno[4];
|
|
|
|
|
1991-04-25 04:20:11 +00:00
|
|
|
};
|
|
|
|
|
1991-05-10 19:41:19 +00:00
|
|
|
#define LINENO struct external_lineno
|
|
|
|
#define LINESZ 8
|
1991-04-25 04:20:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
/********************** SYMBOLS **********************/
|
|
|
|
|
* internalcoff.h (SYMNMLEN, FILNMLEN, DIMNUM): Define these
for internalcoff, separately from the various external coff's.
* amdcoff.h, bcs88kcoff.h, i386coff.h, intel-coff.h, m68kcoff.h,
m88k-bcs.h: Prefix SYMNMLEN, FILNMLEN, and DIMNUM with E_'s for
the external struct definitions.
* ecoff.h: Remove these #define's, kludge no longer needed.
1991-09-12 21:27:49 +00:00
|
|
|
#define E_SYMNMLEN 8 /* # characters in a symbol name */
|
|
|
|
#define E_FILNMLEN 14 /* # characters in a file name */
|
|
|
|
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
|
1991-04-25 04:20:11 +00:00
|
|
|
|
1991-05-10 19:41:19 +00:00
|
|
|
struct external_syment
|
|
|
|
{
|
|
|
|
union {
|
* internalcoff.h (SYMNMLEN, FILNMLEN, DIMNUM): Define these
for internalcoff, separately from the various external coff's.
* amdcoff.h, bcs88kcoff.h, i386coff.h, intel-coff.h, m68kcoff.h,
m88k-bcs.h: Prefix SYMNMLEN, FILNMLEN, and DIMNUM with E_'s for
the external struct definitions.
* ecoff.h: Remove these #define's, kludge no longer needed.
1991-09-12 21:27:49 +00:00
|
|
|
char e_name[E_SYMNMLEN];
|
1991-05-10 19:41:19 +00:00
|
|
|
struct {
|
|
|
|
char e_zeroes[4];
|
|
|
|
char e_offset[4];
|
|
|
|
} e;
|
|
|
|
} e;
|
|
|
|
char e_value[4];
|
|
|
|
char e_scnum[2];
|
|
|
|
char e_type[2];
|
|
|
|
char e_sclass[1];
|
|
|
|
char e_numaux[1];
|
|
|
|
char pad2[2];
|
|
|
|
};
|
1991-04-25 04:20:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define N_BTMASK 017
|
|
|
|
#define N_TMASK 060
|
|
|
|
#define N_BTSHFT 4
|
|
|
|
#define N_TSHIFT 2
|
|
|
|
|
|
|
|
|
1991-06-14 20:48:29 +00:00
|
|
|
/* Note that this isn't the same shape as other coffs */
|
1991-05-10 19:41:19 +00:00
|
|
|
union external_auxent {
|
|
|
|
struct {
|
1991-06-14 20:48:29 +00:00
|
|
|
char x_tagndx[4]; /* str, un, or enum tag indx */
|
|
|
|
/* 4 */
|
1991-05-10 19:41:19 +00:00
|
|
|
union {
|
1991-06-14 20:48:29 +00:00
|
|
|
char x_fsize[4]; /* size of function */
|
1991-05-10 19:41:19 +00:00
|
|
|
struct {
|
1991-06-14 20:48:29 +00:00
|
|
|
char x_lnno[4]; /* declaration line number */
|
|
|
|
char x_size[4]; /* str/union/array size */
|
1991-05-10 19:41:19 +00:00
|
|
|
} x_lnsz;
|
|
|
|
} x_misc;
|
1991-06-14 20:48:29 +00:00
|
|
|
struct { /* if ISFCN, tag, or .bb */
|
|
|
|
char x_lnnoptr[4]; /* ptr to fcn line # */
|
|
|
|
char x_endndx[4]; /* entry ndx past block end */
|
|
|
|
} x_fcn;
|
|
|
|
|
|
|
|
/* 12 */
|
1991-05-10 19:41:19 +00:00
|
|
|
union {
|
|
|
|
struct { /* if ISARY, up to 4 dimen. */
|
* internalcoff.h (SYMNMLEN, FILNMLEN, DIMNUM): Define these
for internalcoff, separately from the various external coff's.
* amdcoff.h, bcs88kcoff.h, i386coff.h, intel-coff.h, m68kcoff.h,
m88k-bcs.h: Prefix SYMNMLEN, FILNMLEN, and DIMNUM with E_'s for
the external struct definitions.
* ecoff.h: Remove these #define's, kludge no longer needed.
1991-09-12 21:27:49 +00:00
|
|
|
char x_dimen[E_DIMNUM][2];
|
1991-05-10 19:41:19 +00:00
|
|
|
} x_ary;
|
|
|
|
} x_fcnary;
|
1991-06-14 20:48:29 +00:00
|
|
|
/* 20 */
|
|
|
|
|
1991-05-10 19:41:19 +00:00
|
|
|
} x_sym;
|
|
|
|
|
|
|
|
union {
|
* internalcoff.h (SYMNMLEN, FILNMLEN, DIMNUM): Define these
for internalcoff, separately from the various external coff's.
* amdcoff.h, bcs88kcoff.h, i386coff.h, intel-coff.h, m68kcoff.h,
m88k-bcs.h: Prefix SYMNMLEN, FILNMLEN, and DIMNUM with E_'s for
the external struct definitions.
* ecoff.h: Remove these #define's, kludge no longer needed.
1991-09-12 21:27:49 +00:00
|
|
|
char x_fname[E_FILNMLEN];
|
1991-05-10 19:41:19 +00:00
|
|
|
struct {
|
1991-06-14 20:48:29 +00:00
|
|
|
char x_zeroes[4];
|
|
|
|
char x_offset[4];
|
1991-05-10 19:41:19 +00:00
|
|
|
} x_n;
|
|
|
|
} x_file;
|
|
|
|
|
|
|
|
struct {
|
1991-06-14 20:48:29 +00:00
|
|
|
char x_scnlen[4]; /* section length */
|
|
|
|
char x_nreloc[4]; /* # relocation entries */
|
|
|
|
char x_nlinno[4]; /* # line numbers */
|
1991-05-10 19:41:19 +00:00
|
|
|
} x_scn;
|
|
|
|
|
|
|
|
struct {
|
1991-06-14 20:48:29 +00:00
|
|
|
char x_tvfill[4]; /* tv fill value */
|
|
|
|
char x_tvlen[2]; /* length of .tv */
|
|
|
|
char x_tvran[2][2]; /* tv range */
|
1991-05-10 19:41:19 +00:00
|
|
|
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
|
1991-06-14 20:48:29 +00:00
|
|
|
|
1991-05-10 19:41:19 +00:00
|
|
|
};
|
1991-04-25 04:20:11 +00:00
|
|
|
|
1991-07-15 23:41:06 +00:00
|
|
|
#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *)ext->x_sym.x_fcn.x_lnnoptr)
|
|
|
|
#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcn.x_endndx)
|
|
|
|
#define PUT_FCN_LNNOPTR(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcn.x_lnnoptr)
|
|
|
|
#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcn.x_endndx)
|
|
|
|
#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
|
|
|
|
#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
|
|
|
|
#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
|
|
|
|
#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
|
|
|
|
#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
|
|
|
|
#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nreloc)
|
|
|
|
#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nlinno)
|
|
|
|
#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
|
|
|
|
#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
|
|
|
|
#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_32(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno)
|
1991-06-14 20:48:29 +00:00
|
|
|
|
1991-05-10 19:41:19 +00:00
|
|
|
#define SYMENT struct external_syment
|
1991-04-25 04:20:11 +00:00
|
|
|
#define SYMESZ 20
|
1991-05-10 19:41:19 +00:00
|
|
|
#define AUXENT union external_auxent
|
1991-04-25 04:20:11 +00:00
|
|
|
#define AUXESZ 20
|
|
|
|
|
|
|
|
|
|
|
|
/********************** RELOCATION DIRECTIVES **********************/
|
|
|
|
|
1991-05-10 19:41:19 +00:00
|
|
|
struct external_reloc {
|
|
|
|
char r_vaddr[4];
|
|
|
|
char r_symndx[4];
|
|
|
|
char r_type[2];
|
|
|
|
char r_offset[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define RELOC struct external_reloc
|
|
|
|
#define RELSZ 12
|
1991-04-25 04:20:11 +00:00
|
|
|
|
|
|
|
#define DEFAULT_SECTION_ALIGNMENT 8 /* double word */
|
1991-06-14 20:48:29 +00:00
|
|
|
|
|
|
|
#define NO_TVNDX
|