]>
Commit | Line | Data |
---|---|---|
095c7223 JG |
1 | /* Rudimentary ECOFF support on MIPS machines. |
2 | This lacks symbol information, normally provided on MIPS Unix systems | |
3 | in the files <sym.h> and <symconst.h>. */ | |
d7344eca JG |
4 | |
5 | /********************** FILE HEADER **********************/ | |
6 | ||
ea017097 SC |
7 | struct external_filehdr { |
8 | char f_magic[2]; /* magic number */ | |
9 | char f_nscns[2]; /* number of sections */ | |
10 | char f_timdat[4]; /* time & date stamp */ | |
11 | char f_symptr[4]; /* file pointer to symtab */ | |
12 | char f_nsyms[4]; /* number of symtab entries */ | |
13 | char f_opthdr[2]; /* sizeof(optional hdr) */ | |
14 | char f_flags[2]; /* flags */ | |
d7344eca JG |
15 | }; |
16 | ||
d7344eca | 17 | |
ea017097 SC |
18 | /* Mips magics */ |
19 | #define MIPS_MAGIC_1 0x0180 | |
20 | #define MIPS_MAGIC_2 0x0162 | |
21 | #define MIPS_MAGIC_3 0x0160 | |
d7344eca | 22 | |
ea017097 SC |
23 | #define ECOFFBADMAG(x) (((x).f_magic!=MIPS_MAGIC_1) && \ |
24 | ((x).f_magic!=MIPS_MAGIC_2) &&\ | |
25 | ((x).f_magic!=MIPS_MAGIC_3)) | |
d7344eca | 26 | |
d7344eca | 27 | |
ea017097 SC |
28 | #define FILHDR struct external_filehdr |
29 | #define FILHSZ 20 | |
d7344eca JG |
30 | |
31 | /********************** AOUT "OPTIONAL HEADER" **********************/ | |
32 | ||
ea017097 | 33 | |
2886a9a9 | 34 | typedef struct external_aouthdr |
ea017097 SC |
35 | { |
36 | char magic[2]; /* type of file */ | |
37 | char vstamp[2]; /* version stamp */ | |
38 | char tsize[4]; /* text size in bytes, padded to FW bdry*/ | |
39 | char dsize[4]; /* initialized data " " */ | |
40 | char bsize[4]; /* uninitialized data " " */ | |
41 | char entry[4]; /* entry pt. */ | |
42 | char text_start[4]; /* base of text used for this file */ | |
43 | char data_start[4]; /* base of data used for this file */ | |
d7344eca JG |
44 | } AOUTHDR; |
45 | ||
d7344eca JG |
46 | /* compute size of a header */ |
47 | ||
d7344eca JG |
48 | #define AOUTSZ (sizeof(AOUTHDR)) |
49 | ||
50 | ||
ea017097 | 51 | /********************** SECTION HEADER **********************/ |
d7344eca | 52 | |
ea017097 SC |
53 | struct external_scnhdr { |
54 | char s_name[8]; /* section name */ | |
55 | char s_paddr[4]; /* physical address, aliased s_nlib */ | |
56 | char s_vaddr[4]; /* virtual address */ | |
57 | char s_size[4]; /* section size */ | |
58 | char s_scnptr[4]; /* file ptr to raw data for section */ | |
59 | char s_relptr[4]; /* file ptr to relocation */ | |
60 | char s_lnnoptr[4]; /* file ptr to line numbers */ | |
61 | char s_nreloc[2]; /* number of relocation entries */ | |
62 | char s_nlnno[2]; /* number of line number entries*/ | |
63 | char s_flags[4]; /* flags */ | |
64 | }; | |
65 | ||
66 | #define SCNHDR struct external_scnhdr | |
d7344eca JG |
67 | #define SCNHSZ sizeof(SCNHDR) |
68 | ||
bc7d7419 JG |
69 | /* |
70 | * names of "special" sections | |
71 | */ | |
72 | #define _TEXT ".text" | |
73 | #define _DATA ".data" | |
74 | #define _BSS ".bss" | |
75 | ||
d7344eca JG |
76 | #define DEFAULT_DATA_SECTION_ALIGNMENT 4 |
77 | #define DEFAULT_BSS_SECTION_ALIGNMENT 4 | |
78 | #define DEFAULT_TEXT_SECTION_ALIGNMENT 16 | |
79 | /* For new sections we havn't heard of before */ | |
80 | #define DEFAULT_SECTION_ALIGNMENT 4 | |
50651e5e JG |
81 | |
82 | /********************** RELOCATION DIRECTIVES **********************/ | |
83 | ||
84 | struct external_reloc { | |
85 | char r_vaddr[4]; | |
86 | char r_symndx[4]; | |
87 | char r_type[2]; | |
88 | char pad[2]; | |
89 | }; | |
90 | ||
91 | ||
92 | /* Relevent values for r_type and ecoff. Would someone please document them */ | |
93 | ||
94 | #define RELOC struct external_reloc | |
95 | #define RELSZ 12 |