]>
Commit | Line | Data |
---|---|---|
fecd2382 RP |
1 | /* This file describes the a.out file format |
2 | Copyright (C) 1987 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GAS, the GNU Assembler. | |
5 | ||
6 | GAS is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
6026cd06 | 8 | the Free Software Foundation; either version 2, or (at your option) |
fecd2382 RP |
9 | any later version. |
10 | ||
11 | GAS is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GAS; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | /* $Id$ */ | |
21 | ||
22 | #ifdef USE_HP_INC_HDR | |
23 | #include "../binutils/hp-include/a.out.h" | |
24 | #else | |
25 | ||
26 | #ifdef USE_SYSTEM_HDR | |
27 | #include "/usr/include/a.out.h" | |
28 | #else | |
29 | ||
30 | #ifdef USE_HP_HDR | |
31 | /* The `exec' structure and overall layout must be close to HP's when | |
32 | we are running on an HP system, otherwise we will not be able to | |
33 | execute the resulting file. */ | |
34 | ||
35 | struct exec | |
36 | { | |
37 | unsigned short a_machtype; /* machine type */ | |
38 | unsigned short a_magic; /* magic number */ | |
39 | unsigned long a_spare1; | |
40 | unsigned long a_spare2; | |
41 | unsigned long a_text; /* length of text, in bytes */ | |
42 | unsigned long a_data; /* length of data, in bytes */ | |
43 | unsigned long a_bss; /* length of uninitialized data area for file, in bytes */ | |
44 | unsigned long a_trsize; /* length of relocation info for text, in bytes */ | |
45 | unsigned long a_drsize; /* length of relocation info for data, in bytes */ | |
46 | unsigned long a_spare3; /* HP = pascal interface size */ | |
47 | unsigned long a_spare4; /* HP = symbol table size */ | |
48 | unsigned long a_spare5; /* HP = debug name table size */ | |
49 | unsigned long a_entry; /* start address */ | |
50 | unsigned long a_spare6; /* HP = source line table size */ | |
51 | unsigned long a_spare7; /* HP = value table size */ | |
52 | unsigned long a_syms; /* length of symbol table data in file, in bytes */ | |
53 | unsigned long a_spare8; | |
54 | }; | |
55 | ||
56 | #define N_MAGIC(exec) ((exec) . a_magic) | |
57 | #define N_MACHTYPE(exec) ((exec) . a_machtype) | |
58 | #define N_SET_MAGIC(exec, magic) (((exec) . a_magic) = (magic)) | |
59 | #define N_SET_MACHTYPE(exec, machtype) (((exec) . a_machtype) = (machtype)) | |
60 | ||
61 | #define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x))) | |
62 | ||
63 | #define _N_BADMACH(x) \ | |
64 | (((N_MACHTYPE (x)) != HP9000S200_ID) && \ | |
65 | ((N_MACHTYPE (x)) != HP98x6_ID)) | |
66 | ||
67 | #define _N_BADMAG(x) \ | |
68 | (((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC) | |
69 | ||
70 | #define HP98x6_ID 0x20A | |
71 | #define HP9000S200_ID 0x20C | |
72 | ||
73 | #else | |
74 | ||
75 | /* A Generic machine. . . */ | |
76 | ||
77 | /* JF I'm not sure where this file came from. I put the permit.text message in | |
78 | it anyway. This file came to me as part of the original VAX assembler, but had | |
79 | no copyright notices in it. */ | |
80 | ||
81 | struct exec { | |
82 | long a_magic; /* number identifies as .o file and gives type of such. */ | |
83 | unsigned a_text; /* length of text, in bytes */ | |
84 | unsigned a_data; /* length of data, in bytes */ | |
85 | unsigned a_bss; /* length of uninitialized data area for file, in bytes */ | |
86 | unsigned a_syms; /* length of symbol table data in file, in bytes */ | |
87 | unsigned a_entry; /* start address */ | |
88 | unsigned a_trsize; /* length of relocation info for text, in bytes */ | |
89 | unsigned a_drsize; /* length of relocation info for data, in bytes */ | |
90 | }; | |
91 | ||
92 | #define N_BADMAG(x) \ | |
93 | (((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC) | |
94 | ||
95 | #endif | |
96 | ||
97 | /* From here down is common to both the HP and the generic machine */ | |
98 | #define OMAGIC 0407 | |
99 | #define NMAGIC 0410 | |
100 | #define ZMAGIC 0413 | |
101 | ||
102 | ||
103 | #define N_TXTOFF(x) \ | |
104 | ((x).a_magic == ZMAGIC ? 1024 : sizeof(struct exec)) | |
105 | ||
106 | #define N_SYMOFF(x) \ | |
107 | (N_TXTOFF(x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize) | |
108 | ||
109 | #define N_STROFF(x) \ | |
110 | (N_SYMOFF(x) + (x).a_syms) | |
111 | ||
112 | struct nlist { | |
113 | union { | |
114 | char *n_name; | |
115 | struct nlist *n_next; | |
116 | long n_strx; | |
117 | } n_un; | |
118 | char n_type; | |
119 | char n_other; | |
120 | short n_desc; | |
121 | unsigned n_value; | |
122 | }; | |
123 | ||
124 | #define N_UNDF 0 | |
125 | #define N_ABS 2 | |
126 | #define N_TEXT 4 | |
127 | #define N_DATA 6 | |
128 | #define N_BSS 8 | |
129 | #define N_FN 31 /* JF: Someone claims this should be 31 instead of | |
130 | 15. I just inherited this file; I didn't write | |
131 | it. Who is right? */ | |
132 | ||
133 | ||
134 | #define N_EXT 1 | |
135 | #define N_TYPE 036 | |
136 | #define N_STAB 0340 | |
137 | ||
138 | struct relocation_info { | |
139 | int r_address; | |
140 | unsigned r_symbolnum:24, | |
141 | r_pcrel:1, | |
142 | r_length:2, | |
143 | r_extern:1, | |
144 | r_bsr:1, /* OVE: used on ns32k based systems, if you want */ | |
145 | r_disp:1, /* OVE: used on ns32k based systems, if you want */ | |
146 | nuthin:2; | |
147 | }; | |
148 | ||
149 | #endif | |
150 | #endif |