0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 struct external_filehdr {
0014 char f_magic[2];
0015 char f_nscns[2];
0016 char f_timdat[4];
0017 char f_symptr[4];
0018 char f_nsyms[4];
0019 char f_opthdr[2];
0020 char f_flags[2];
0021 };
0022
0023
0024 #define U802WRMAGIC 0730
0025 #define U802ROMAGIC 0735
0026 #define U802TOCMAGIC 0737
0027
0028 #define BADMAG(x) \
0029 ((x).f_magic != U802ROMAGIC && (x).f_magic != U802WRMAGIC && \
0030 (x).f_magic != U802TOCMAGIC)
0031
0032 #define FILHDR struct external_filehdr
0033 #define FILHSZ 20
0034
0035
0036
0037
0038
0039 typedef struct
0040 {
0041 unsigned char magic[2];
0042 unsigned char vstamp[2];
0043 unsigned char tsize[4];
0044 unsigned char dsize[4];
0045 unsigned char bsize[4];
0046 unsigned char entry[4];
0047 unsigned char text_start[4];
0048 unsigned char data_start[4];
0049 unsigned char o_toc[4];
0050 unsigned char o_snentry[2];
0051 unsigned char o_sntext[2];
0052 unsigned char o_sndata[2];
0053 unsigned char o_sntoc[2];
0054 unsigned char o_snloader[2];
0055 unsigned char o_snbss[2];
0056 unsigned char o_algntext[2];
0057 unsigned char o_algndata[2];
0058 unsigned char o_modtype[2];
0059 unsigned char o_cputype[2];
0060 unsigned char o_maxstack[4];
0061 unsigned char o_maxdata[4];
0062 unsigned char o_resv2[12];
0063 }
0064 AOUTHDR;
0065
0066 #define AOUTSZ 72
0067 #define SMALL_AOUTSZ (28)
0068 #define AOUTHDRSZ 72
0069
0070 #define RS6K_AOUTHDR_OMAGIC 0x0107
0071 #define RS6K_AOUTHDR_NMAGIC 0x0108
0072 #define RS6K_AOUTHDR_ZMAGIC 0x010B
0073
0074
0075
0076
0077
0078 struct external_scnhdr {
0079 char s_name[8];
0080 char s_paddr[4];
0081 char s_vaddr[4];
0082 char s_size[4];
0083 char s_scnptr[4];
0084 char s_relptr[4];
0085 char s_lnnoptr[4];
0086 char s_nreloc[2];
0087 char s_nlnno[2];
0088 char s_flags[4];
0089 };
0090
0091
0092
0093
0094 #define _TEXT ".text"
0095 #define _DATA ".data"
0096 #define _BSS ".bss"
0097 #define _PAD ".pad"
0098 #define _LOADER ".loader"
0099
0100 #define SCNHDR struct external_scnhdr
0101 #define SCNHSZ 40
0102
0103
0104 #define STYP_LOADER 0x1000
0105
0106
0107 #define STYP_DEBUG 0x2000
0108
0109
0110
0111 #define STYP_OVRFLO 0x8000
0112
0113
0114
0115
0116
0117
0118
0119
0120 struct external_lineno {
0121 union {
0122 char l_symndx[4];
0123 char l_paddr[4];
0124 } l_addr;
0125 char l_lnno[2];
0126 };
0127
0128
0129 #define LINENO struct external_lineno
0130 #define LINESZ 6
0131
0132
0133
0134
0135 #define E_SYMNMLEN 8
0136 #define E_FILNMLEN 14
0137 #define E_DIMNUM 4
0138
0139 struct external_syment
0140 {
0141 union {
0142 char e_name[E_SYMNMLEN];
0143 struct {
0144 char e_zeroes[4];
0145 char e_offset[4];
0146 } e;
0147 } e;
0148 char e_value[4];
0149 char e_scnum[2];
0150 char e_type[2];
0151 char e_sclass[1];
0152 char e_numaux[1];
0153 };
0154
0155
0156
0157 #define N_BTMASK (017)
0158 #define N_TMASK (060)
0159 #define N_BTSHFT (4)
0160 #define N_TSHIFT (2)
0161
0162
0163 union external_auxent {
0164 struct {
0165 char x_tagndx[4];
0166 union {
0167 struct {
0168 char x_lnno[2];
0169 char x_size[2];
0170 } x_lnsz;
0171 char x_fsize[4];
0172 } x_misc;
0173 union {
0174 struct {
0175 char x_lnnoptr[4];
0176 char x_endndx[4];
0177 } x_fcn;
0178 struct {
0179 char x_dimen[E_DIMNUM][2];
0180 } x_ary;
0181 } x_fcnary;
0182 char x_tvndx[2];
0183 } x_sym;
0184
0185 union {
0186 char x_fname[E_FILNMLEN];
0187 struct {
0188 char x_zeroes[4];
0189 char x_offset[4];
0190 } x_n;
0191 } x_file;
0192
0193 struct {
0194 char x_scnlen[4];
0195 char x_nreloc[2];
0196 char x_nlinno[2];
0197 } x_scn;
0198
0199 struct {
0200 char x_tvfill[4];
0201 char x_tvlen[2];
0202 char x_tvran[2][2];
0203 } x_tv;
0204
0205 struct {
0206 unsigned char x_scnlen[4];
0207 unsigned char x_parmhash[4];
0208 unsigned char x_snhash[2];
0209 unsigned char x_smtyp[1];
0210 unsigned char x_smclas[1];
0211 unsigned char x_stab[4];
0212 unsigned char x_snstab[2];
0213 } x_csect;
0214
0215 };
0216
0217 #define SYMENT struct external_syment
0218 #define SYMESZ 18
0219 #define AUXENT union external_auxent
0220 #define AUXESZ 18
0221 #define DBXMASK 0x80
0222 #define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
0223
0224
0225
0226
0227
0228
0229 struct external_reloc {
0230 char r_vaddr[4];
0231 char r_symndx[4];
0232 char r_size[1];
0233 char r_type[1];
0234 };
0235
0236
0237 #define RELOC struct external_reloc
0238 #define RELSZ 10
0239
0240 #define DEFAULT_DATA_SECTION_ALIGNMENT 4
0241 #define DEFAULT_BSS_SECTION_ALIGNMENT 4
0242 #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
0243
0244 #define DEFAULT_SECTION_ALIGNMENT 4