00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef COFF_EXTERNAL_H
00020 #define COFF_EXTERNAL_H
00021
00022 #ifndef DO_NOT_DEFINE_FILHDR
00023
00024
00025 struct external_filehdr
00026 {
00027 char f_magic[2];
00028 char f_nscns[2];
00029 char f_timdat[4];
00030 char f_symptr[4];
00031 char f_nsyms[4];
00032 char f_opthdr[2];
00033 char f_flags[2];
00034 };
00035
00036 #define FILHDR struct external_filehdr
00037 #define FILHSZ 20
00038 #endif
00039
00040 #ifndef DO_NOT_DEFINE_AOUTHDR
00041
00042
00043 typedef struct external_aouthdr
00044 {
00045 char magic[2];
00046 char vstamp[2];
00047 char tsize[4];
00048 char dsize[4];
00049 char bsize[4];
00050 char entry[4];
00051 char text_start[4];
00052 char data_start[4];
00053 }
00054 AOUTHDR;
00055
00056 #define AOUTHDRSZ 28
00057 #define AOUTSZ 28
00058 #endif
00059
00060 #ifndef DO_NOT_DEFINE_SCNHDR
00061
00062
00063 struct external_scnhdr
00064 {
00065 char s_name[8];
00066 char s_paddr[4];
00067 char s_vaddr[4];
00068 char s_size[4];
00069 char s_scnptr[4];
00070 char s_relptr[4];
00071 char s_lnnoptr[4];
00072 char s_nreloc[2];
00073 char s_nlnno[2];
00074 char s_flags[4];
00075 };
00076
00077 #define SCNHDR struct external_scnhdr
00078 #define SCNHSZ 40
00079
00080
00081
00082 #define _TEXT ".text"
00083 #define _DATA ".data"
00084 #define _BSS ".bss"
00085 #define _COMMENT ".comment"
00086 #define _LIB ".lib"
00087 #endif
00088
00089 #ifndef DO_NOT_DEFINE_LINENO
00090
00091
00092
00093 #ifndef L_LNNO_SIZE
00094 #error L_LNNO_SIZE needs to be defined
00095 #endif
00096
00097
00098
00099
00100
00101 struct external_lineno
00102 {
00103 union
00104 {
00105 char l_symndx[4];
00106 char l_paddr[4];
00107 } l_addr;
00108
00109 char l_lnno[L_LNNO_SIZE];
00110 };
00111
00112 #define LINENO struct external_lineno
00113 #define LINESZ (4 + L_LNNO_SIZE)
00114
00115 #if L_LNNO_SIZE == 4
00116 #define GET_LINENO_LNNO(abfd, ext) H_GET_32 (abfd, (ext->l_lnno))
00117 #define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_32 (abfd, val, (ext->l_lnno))
00118 #endif
00119 #if L_LNNO_SIZE == 2
00120 #define GET_LINENO_LNNO(abfd, ext) H_GET_16 (abfd, (ext->l_lnno))
00121 #define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_16 (abfd, val, (ext->l_lnno))
00122 #endif
00123
00124 #endif
00125
00126 #ifndef DO_NOT_DEFINE_SYMENT
00127
00128
00129 #define E_SYMNMLEN 8
00130 #ifndef E_FILNMLEN
00131 #define E_FILNMLEN 14
00132 #endif
00133 #define E_DIMNUM 4
00134
00135 struct external_syment
00136 {
00137 union
00138 {
00139 char e_name[E_SYMNMLEN];
00140
00141 struct
00142 {
00143 char e_zeroes[4];
00144 char e_offset[4];
00145 } e;
00146 } e;
00147
00148 char e_value[4];
00149 char e_scnum[2];
00150 char e_type[2];
00151 char e_sclass[1];
00152 char e_numaux[1];
00153 };
00154
00155 #define SYMENT struct external_syment
00156 #define SYMESZ 18
00157
00158 #ifndef N_BTMASK
00159 #define N_BTMASK 0xf
00160 #endif
00161
00162 #ifndef N_TMASK
00163 #define N_TMASK 0x30
00164 #endif
00165
00166 #ifndef N_BTSHFT
00167 #define N_BTSHFT 4
00168 #endif
00169
00170 #ifndef N_TSHIFT
00171 #define N_TSHIFT 2
00172 #endif
00173
00174 #endif
00175
00176 #ifndef DO_NOT_DEFINE_AUXENT
00177
00178 union external_auxent
00179 {
00180 struct
00181 {
00182 char x_tagndx[4];
00183
00184 union
00185 {
00186 struct
00187 {
00188 char x_lnno[2];
00189 char x_size[2];
00190 } x_lnsz;
00191
00192 char x_fsize[4];
00193
00194 } x_misc;
00195
00196 union
00197 {
00198 struct
00199 {
00200 char x_lnnoptr[4];
00201 char x_endndx[4];
00202 } x_fcn;
00203
00204 struct
00205 {
00206 char x_dimen[E_DIMNUM][2];
00207 } x_ary;
00208
00209 } x_fcnary;
00210
00211 char x_tvndx[2];
00212
00213 } x_sym;
00214
00215 union
00216 {
00217 char x_fname[E_FILNMLEN];
00218
00219 struct
00220 {
00221 char x_zeroes[4];
00222 char x_offset[4];
00223 } x_n;
00224
00225 } x_file;
00226
00227 struct
00228 {
00229 char x_scnlen[4];
00230 char x_nreloc[2];
00231 char x_nlinno[2];
00232 #ifdef INCLUDE_COMDAT_FIELDS_IN_AUXENT
00233 char x_checksum[4];
00234 char x_associated[2];
00235 char x_comdat[1];
00236 #endif
00237 } x_scn;
00238
00239 struct
00240 {
00241 char x_tvfill[4];
00242 char x_tvlen[2];
00243 char x_tvran[2][2];
00244 } x_tv;
00245 };
00246
00247 #define AUXENT union external_auxent
00248 #define AUXESZ 18
00249
00250 #define _ETEXT "etext"
00251
00252 #endif
00253
00254 #endif