Show full pathnames.
[deliverable/binutils-gdb.git] / gas / config / obj-coffbfd.h
1 /* coff object file format
2 Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
3
4 This file is part of GAS.
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
8 the Free Software Foundation; either version 2, or (at your option)
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 #ifndef OBJ_FORMAT_H
21 #define OBJ_FORMAT_H
22
23 #define OBJ_COFF 1
24
25 #define WORKING_DOT_WORD
26 #define WARN_SIGNED_OVERFLOW_WORD
27
28 /* By default we omit the optional aouthdr. */
29 #define OBJ_COFF_OMIT_OPTIONAL_HEADER
30
31 #include "targ-cpu.h"
32
33 #include "bfd.h"
34
35 /* This internal_lineno crap is to stop namespace pollution from the
36 bfd internal coff headerfile. */
37
38 #define internal_lineno bfd_internal_lineno
39 #include "coff/internal.h"
40 #undef internal_lineno
41
42 #ifdef TC_Z8K
43 #include "coff/z8k.h"
44 #define TARGET_FORMAT "coff-z8k"
45 #endif
46
47 #ifdef TC_H8300
48 #include "coff/h8300.h"
49 #define TARGET_FORMAT "coff-h8300"
50 #endif
51
52 #ifdef TC_H8500
53 #include "coff/h8500.h"
54 #define TARGET_FORMAT "coff-h8500"
55 #endif
56
57 #ifdef TC_SH
58 #include "coff/sh.h"
59 #define TARGET_FORMAT "coff-sh"
60 #endif
61
62 #ifdef TC_M68K
63 #include "coff/m68k.h"
64 #ifndef TARGET_FORMAT
65 #define TARGET_FORMAT "coff-m68k"
66 #endif
67 #endif
68
69 #ifdef TC_M88K
70 #include "coff/m88k.h"
71 #define TARGET_FORMAT "coff-m88kbcs"
72 #endif
73
74 #ifdef TC_I386
75 #include "coff/i386.h"
76 #ifndef TARGET_FORMAT
77 #define TARGET_FORMAT "coff-i386"
78 #endif
79 #endif
80
81 #ifdef TC_A29K
82 #include "coff/a29k.h"
83 #define TARGET_FORMAT "coff-a29k-big"
84
85 /* Allow translate from aout relocs to coff relocs */
86 #define NO_RELOC 20
87 #define RELOC_32 1
88 #define RELOC_8 2
89 #define RELOC_CONST 3
90 #define RELOC_CONSTH 4
91 #define RELOC_JUMPTARG 5
92 #define RELOC_BASE22 6
93 #define RELOC_HI22 7
94 #define RELOC_LO10 8
95 #define RELOC_BASE13 9
96 #define RELOC_WDISP22 10
97 #define RELOC_WDISP30 11
98 #endif
99
100
101
102
103 #ifndef OBJ_COFF_MAX_AUXENTRIES
104 #define OBJ_COFF_MAX_AUXENTRIES 1
105 #endif /* OBJ_COFF_MAX_AUXENTRIES */
106
107
108 extern const segT N_TYPE_seg[];
109
110 /* Magic number of paged executable. */
111 #define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE 0x8300
112
113
114 /* SYMBOL TABLE */
115
116 /* targets may also set this */
117 #ifndef SYMBOLS_NEED_BACKPOINTERS
118 #define SYMBOLS_NEED_BACKPOINTERS 1
119 #endif /* SYMBOLS_NEED_BACKPOINTERS */
120
121 /* Symbol table entry data type */
122
123 typedef struct
124 {
125 struct internal_syment ost_entry; /* Basic symbol */
126 union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
127
128 unsigned int ost_flags; /* obj_coff internal use only flags */
129 }
130
131 obj_symbol_type;
132
133 #ifndef DO_NOT_STRIP
134 #define DO_NOT_STRIP 0
135 #define DO_STRIP 1
136 #endif
137 /* Symbol table macros and constants */
138
139 /* Possible and usefull section number in symbol table
140 * The values of TEXT, DATA and BSS may not be portable.
141 */
142
143 #define C_ABS_SECTION N_ABS
144 #define C_UNDEF_SECTION N_UNDEF
145 #define C_DEBUG_SECTION N_DEBUG
146 #define C_NTV_SECTION N_TV
147 #define C_PTV_SECTION P_TV
148 #define C_REGISTER_SECTION 20
149
150 /*
151 * Macros to extract information from a symbol table entry.
152 * This syntaxic indirection allows independence regarding a.out or coff.
153 * The argument (s) of all these macros is a pointer to a symbol table entry.
154 */
155
156 /* Predicates */
157 /* True if the symbol is external */
158 #define S_IS_EXTERNAL(s) ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION)
159 /* True if symbol has been defined, ie :
160 section > 0 (DATA, TEXT or BSS)
161 section == 0 and value > 0 (external bss symbol) */
162 #define S_IS_DEFINED(s) ((s)->sy_symbol.ost_entry.n_scnum > C_UNDEF_SECTION || \
163 ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION && \
164 S_GET_VALUE (s) > 0))
165 /* True if a debug special symbol entry */
166 #define S_IS_DEBUG(s) ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
167 /* True if a symbol is local symbol name */
168 /* A symbol name whose name includes ^A is a gas internal pseudo symbol */
169 #define S_IS_LOCAL(s) \
170 ((s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION \
171 || (S_LOCAL_NAME(s) && !flagseen['L']) \
172 || (strchr (S_GET_NAME (s), '\001') != NULL))
173 /* True if a symbol is not defined in this file */
174 #define S_IS_EXTERN(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 \
175 && S_GET_VALUE (s) == 0)
176 /*
177 * True if a symbol can be multiply defined (bss symbols have this def
178 * though it is bad practice)
179 */
180 #define S_IS_COMMON(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 \
181 && S_GET_VALUE (s) != 0)
182 /* True if a symbol name is in the string table, i.e. its length is > 8. */
183 #define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
184
185 /* Accessors */
186 /* The name of the symbol */
187 #define S_GET_NAME(s) ((char*)(s)->sy_symbol.ost_entry.n_offset)
188 /* The pointer to the string table */
189 #define S_GET_OFFSET(s) ((s)->sy_symbol.ost_entry.n_offset)
190 /* The zeroes if symbol name is longer than 8 chars */
191 #define S_GET_ZEROES(s) ((s)->sy_symbol.ost_entry.n_zeroes)
192 /* The numeric value of the segment */
193 #define S_GET_SEGMENT(s) s_get_segment(s)
194 /* The data type */
195 #define S_GET_DATA_TYPE(s) ((s)->sy_symbol.ost_entry.n_type)
196 /* The storage class */
197 #define S_GET_STORAGE_CLASS(s) ((s)->sy_symbol.ost_entry.n_sclass)
198 /* The number of auxiliary entries */
199 #define S_GET_NUMBER_AUXILIARY(s) ((s)->sy_symbol.ost_entry.n_numaux)
200
201 /* Modifiers */
202 /* Set the name of the symbol */
203 #define S_SET_NAME(s,v) ((s)->sy_symbol.ost_entry.n_offset = (unsigned long)(v))
204 /* Set the offset of the symbol */
205 #define S_SET_OFFSET(s,v) ((s)->sy_symbol.ost_entry.n_offset = (v))
206 /* The zeroes if symbol name is longer than 8 chars */
207 #define S_SET_ZEROES(s,v) ((s)->sy_symbol.ost_entry.n_zeroes = (v))
208 /* The numeric value of the segment */
209 #define S_SET_SEGMENT(s,v) ((s)->sy_symbol.ost_entry.n_scnum = SEGMENT_TO_SYMBOL_TYPE(v))
210 /* The data type */
211 #define S_SET_DATA_TYPE(s,v) ((s)->sy_symbol.ost_entry.n_type = (v))
212 /* The storage class */
213 #define S_SET_STORAGE_CLASS(s,v) ((s)->sy_symbol.ost_entry.n_sclass = (v))
214 /* The number of auxiliary entries */
215 #define S_SET_NUMBER_AUXILIARY(s,v) ((s)->sy_symbol.ost_entry.n_numaux = (v))
216
217 /* Additional modifiers */
218 /* The symbol is external (does not mean undefined) */
219 #define S_SET_EXTERNAL(s) { S_SET_STORAGE_CLASS(s, C_EXT) ; SF_CLEAR_LOCAL(s); }
220
221 /* Auxiliary entry macros. SA_ stands for symbol auxiliary */
222 /* Omit the tv related fields */
223 /* Accessors */
224 #ifdef BFD_HEADERS
225 #define SA_GET_SYM_TAGNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx.l)
226 #else
227 #define SA_GET_SYM_TAGNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx)
228 #endif
229 #define SA_GET_SYM_LNNO(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno)
230 #define SA_GET_SYM_SIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size)
231 #define SA_GET_SYM_FSIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize)
232 #define SA_GET_SYM_LNNOPTR(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr)
233 #ifdef BFD_HEADERS
234 #define SA_GET_SYM_ENDNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx.l)
235 #else
236 #define SA_GET_SYM_ENDNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx)
237 #endif
238 #define SA_GET_SYM_DIMEN(s,i) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)])
239 #define SA_GET_FILE_FNAME(s) ((s)->sy_symbol.ost_auxent[0].x_file.x_fname)
240 #define SA_GET_SCN_SCNLEN(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen)
241 #define SA_GET_SCN_NRELOC(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc)
242 #define SA_GET_SCN_NLINNO(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno)
243
244 /* Modifiers */
245 #ifdef BFD_HEADERS
246 #define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx.l=(v))
247 #else
248 #define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx=(v))
249 #endif
250 #define SA_SET_SYM_LNNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno=(v))
251 #define SA_SET_SYM_SIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size=(v))
252 #define SA_SET_SYM_FSIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize=(v))
253 #define SA_SET_SYM_LNNOPTR(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr=(v))
254 #ifdef BFD_HEADERS
255 #define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx.l=(v))
256 #else
257 #define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx=(v))
258 #endif
259 #define SA_SET_SYM_DIMEN(s,i,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
260 #define SA_SET_FILE_FNAME(s,v) strncpy((s)->sy_symbol.ost_auxent[0].x_file.x_fname,(v),FILNMLEN)
261 #define SA_SET_SCN_SCNLEN(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen=(v))
262 #define SA_SET_SCN_NRELOC(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc=(v))
263 #define SA_SET_SCN_NLINNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno=(v))
264
265 /*
266 * Internal use only definitions. SF_ stands for symbol flags.
267 *
268 * These values can be assigned to sy_symbol.ost_flags field of a symbolS.
269 *
270 * You'll break i960 if you shift the SYSPROC bits anywhere else. for
271 * more on the balname/callname hack, see tc-i960.h. b.out is done
272 * differently.
273 */
274
275 #define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */
276 #define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */
277 #define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */
278 #define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */
279 #define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */
280
281 #define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */
282
283 #define SF_STATICS (0x00001000) /* Mark the .text & all symbols */
284 #define SF_DEFINED (0x00002000) /* Symbol is defined in this file */
285 #define SF_STRING (0x00004000) /* Symbol name length > 8 */
286 #define SF_LOCAL (0x00008000) /* Symbol must not be emitted */
287
288 #define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */
289
290 #define SF_FUNCTION (0x00010000) /* The symbol is a function */
291 #define SF_PROCESS (0x00020000) /* Process symbol before write */
292 #define SF_TAGGED (0x00040000) /* Is associated with a tag */
293 #define SF_TAG (0x00080000) /* Is a tag */
294 #define SF_DEBUG (0x00100000) /* Is in debug or abs section */
295 #define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */
296 /* All other bits are unused. */
297
298 /* Accessors */
299 #define SF_GET(s) ((s)->sy_symbol.ost_flags)
300 #define SF_GET_NORMAL_FIELD(s) ((s)->sy_symbol.ost_flags & SF_NORMAL_MASK)
301 #define SF_GET_DEBUG_FIELD(s) ((s)->sy_symbol.ost_flags & SF_DEBUG_MASK)
302 #define SF_GET_FILE(s) ((s)->sy_symbol.ost_flags & SF_FILE)
303 #define SF_GET_STATICS(s) ((s)->sy_symbol.ost_flags & SF_STATICS)
304 #define SF_GET_DEFINED(s) ((s)->sy_symbol.ost_flags & SF_DEFINED)
305 #define SF_GET_STRING(s) ((s)->sy_symbol.ost_flags & SF_STRING)
306 #define SF_GET_LOCAL(s) ((s)->sy_symbol.ost_flags & SF_LOCAL)
307 #define SF_GET_FUNCTION(s) ((s)->sy_symbol.ost_flags & SF_FUNCTION)
308 #define SF_GET_PROCESS(s) ((s)->sy_symbol.ost_flags & SF_PROCESS)
309 #define SF_GET_DEBUG(s) ((s)->sy_symbol.ost_flags & SF_DEBUG)
310 #define SF_GET_TAGGED(s) ((s)->sy_symbol.ost_flags & SF_TAGGED)
311 #define SF_GET_TAG(s) ((s)->sy_symbol.ost_flags & SF_TAG)
312 #define SF_GET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags & SF_GET_SEGMENT)
313 #define SF_GET_I960(s) ((s)->sy_symbol.ost_flags & SF_I960_MASK) /* used by i960 */
314 #define SF_GET_BALNAME(s) ((s)->sy_symbol.ost_flags & SF_BALNAME) /* used by i960 */
315 #define SF_GET_CALLNAME(s) ((s)->sy_symbol.ost_flags & SF_CALLNAME) /* used by i960 */
316 #define SF_GET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_IS_SYSPROC) /* used by i960 */
317 #define SF_GET_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_SYSPROC) /* used by i960 */
318
319 /* Modifiers */
320 #define SF_SET(s,v) ((s)->sy_symbol.ost_flags = (v))
321 #define SF_SET_NORMAL_FIELD(s,v)((s)->sy_symbol.ost_flags |= ((v) & SF_NORMAL_MASK))
322 #define SF_SET_DEBUG_FIELD(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_DEBUG_MASK))
323 #define SF_SET_FILE(s) ((s)->sy_symbol.ost_flags |= SF_FILE)
324 #define SF_SET_STATICS(s) ((s)->sy_symbol.ost_flags |= SF_STATICS)
325 #define SF_SET_DEFINED(s) ((s)->sy_symbol.ost_flags |= SF_DEFINED)
326 #define SF_SET_STRING(s) ((s)->sy_symbol.ost_flags |= SF_STRING)
327 #define SF_SET_LOCAL(s) ((s)->sy_symbol.ost_flags |= SF_LOCAL)
328 #define SF_CLEAR_LOCAL(s) ((s)->sy_symbol.ost_flags &= ~SF_LOCAL)
329 #define SF_SET_FUNCTION(s) ((s)->sy_symbol.ost_flags |= SF_FUNCTION)
330 #define SF_SET_PROCESS(s) ((s)->sy_symbol.ost_flags |= SF_PROCESS)
331 #define SF_SET_DEBUG(s) ((s)->sy_symbol.ost_flags |= SF_DEBUG)
332 #define SF_SET_TAGGED(s) ((s)->sy_symbol.ost_flags |= SF_TAGGED)
333 #define SF_SET_TAG(s) ((s)->sy_symbol.ost_flags |= SF_TAG)
334 #define SF_SET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags |= SF_GET_SEGMENT)
335 #define SF_SET_I960(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_I960_MASK)) /* used by i960 */
336 #define SF_SET_BALNAME(s) ((s)->sy_symbol.ost_flags |= SF_BALNAME) /* used by i960 */
337 #define SF_SET_CALLNAME(s) ((s)->sy_symbol.ost_flags |= SF_CALLNAME) /* used by i960 */
338 #define SF_SET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags |= SF_IS_SYSPROC) /* used by i960 */
339 #define SF_SET_SYSPROC(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_SYSPROC)) /* used by i960 */
340
341 /* File header macro and type definition */
342
343 /*
344 * File position calculators. Beware to use them when all the
345 * appropriate fields are set in the header.
346 */
347
348 #ifdef OBJ_COFF_OMIT_OPTIONAL_HEADER
349 #define OBJ_COFF_AOUTHDRSZ (0)
350 #else
351 #define OBJ_COFF_AOUTHDRSZ (AOUTHDRSZ)
352 #endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
353
354 #define H_GET_FILE_SIZE(h) \
355 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
356 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
357 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
358 H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h) + \
359 H_GET_SYMBOL_TABLE_SIZE(h) + \
360 (h)->string_table_size)
361 #define H_GET_TEXT_FILE_OFFSET(h) \
362 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
363 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)
364 #define H_GET_DATA_FILE_OFFSET(h) \
365 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
366 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
367 H_GET_TEXT_SIZE(h))
368 #define H_GET_BSS_FILE_OFFSET(h) 0
369 #define H_GET_RELOCATION_FILE_OFFSET(h) \
370 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
371 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
372 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h))
373 #define H_GET_LINENO_FILE_OFFSET(h) \
374 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
375 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
376 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
377 H_GET_RELOCATION_SIZE(h))
378 #define H_GET_SYMBOL_TABLE_FILE_OFFSET(h) \
379 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
380 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
381 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
382 H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h))
383
384 /* Accessors */
385 /* aouthdr */
386 #define H_GET_MAGIC_NUMBER(h) ((h)->aouthdr.magic)
387 #define H_GET_VERSION_STAMP(h) ((h)->aouthdr.vstamp)
388 #define H_GET_TEXT_SIZE(h) ((h)->aouthdr.tsize)
389 #define H_GET_DATA_SIZE(h) ((h)->aouthdr.dsize)
390 #define H_GET_BSS_SIZE(h) ((h)->aouthdr.bsize)
391 #define H_GET_ENTRY_POINT(h) ((h)->aouthdr.entry)
392 #define H_GET_TEXT_START(h) ((h)->aouthdr.text_start)
393 #define H_GET_DATA_START(h) ((h)->aouthdr.data_start)
394 /* filehdr */
395 #define H_GET_FILE_MAGIC_NUMBER(h) ((h)->filehdr.f_magic)
396 #define H_GET_NUMBER_OF_SECTIONS(h) ((h)->filehdr.f_nscns)
397 #define H_GET_TIME_STAMP(h) ((h)->filehdr.f_timdat)
398 #define H_GET_SYMBOL_TABLE_POINTER(h) ((h)->filehdr.f_symptr)
399 #define H_GET_SYMBOL_COUNT(h) ((h)->filehdr.f_nsyms)
400 #define H_GET_SYMBOL_TABLE_SIZE(h) (H_GET_SYMBOL_COUNT(h) * SYMESZ)
401 #define H_GET_SIZEOF_OPTIONAL_HEADER(h) ((h)->filehdr.f_opthdr)
402 #define H_GET_FLAGS(h) ((h)->filehdr.f_flags)
403 /* Extra fields to achieve bsd a.out compatibility and for convenience */
404 #define H_GET_RELOCATION_SIZE(h) ((h)->relocation_size)
405 #define H_GET_STRING_SIZE(h) ((h)->string_table_size)
406 #define H_GET_LINENO_SIZE(h) ((h)->lineno_size)
407
408 #ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER
409 #define H_GET_HEADER_SIZE(h) (sizeof(FILHDR) \
410 + sizeof(AOUTHDR)\
411 + (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ))
412 #else /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
413 #define H_GET_HEADER_SIZE(h) (sizeof(FILHDR) \
414 + (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ))
415 #endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
416
417 #define H_GET_TEXT_RELOCATION_SIZE(h) (text_section_header.s_nreloc * RELSZ)
418 #define H_GET_DATA_RELOCATION_SIZE(h) (data_section_header.s_nreloc * RELSZ)
419
420 /* Modifiers */
421 /* aouthdr */
422 #define H_SET_MAGIC_NUMBER(h,v) ((h)->aouthdr.magic = (v))
423 #define H_SET_VERSION_STAMP(h,v) ((h)->aouthdr.vstamp = (v))
424 #define H_SET_TEXT_SIZE(h,v) ((h)->aouthdr.tsize = (v))
425 #define H_SET_DATA_SIZE(h,v) ((h)->aouthdr.dsize = (v))
426 #define H_SET_BSS_SIZE(h,v) ((h)->aouthdr.bsize = (v))
427 #define H_SET_ENTRY_POINT(h,v) ((h)->aouthdr.entry = (v))
428 #define H_SET_TEXT_START(h,v) ((h)->aouthdr.text_start = (v))
429 #define H_SET_DATA_START(h,v) ((h)->aouthdr.data_start = (v))
430 /* filehdr */
431 #define H_SET_FILE_MAGIC_NUMBER(h,v) ((h)->filehdr.f_magic = (v))
432 #define H_SET_NUMBER_OF_SECTIONS(h,v) ((h)->filehdr.f_nscns = (v))
433 #define H_SET_TIME_STAMP(h,v) ((h)->filehdr.f_timdat = (v))
434 #define H_SET_SYMBOL_TABLE_POINTER(h,v) ((h)->filehdr.f_symptr = (v))
435 #define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->filehdr.f_nsyms = (v))
436 #define H_SET_SIZEOF_OPTIONAL_HEADER(h,v) ((h)->filehdr.f_opthdr = (v))
437 #define H_SET_FLAGS(h,v) ((h)->filehdr.f_flags = (v))
438 /* Extra fields to achieve bsd a.out compatibility and for convinience */
439 #define H_SET_RELOCATION_SIZE(h,t,d) ((h)->relocation_size = (t)+(d))
440 #define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
441 #define H_SET_LINENO_SIZE(h,v) ((h)->lineno_size = (v))
442
443 /* Segment flipping */
444
445 typedef struct
446 {
447 #ifdef BFD_HEADERS
448 struct internal_aouthdr aouthdr; /* a.out header */
449 struct internal_filehdr filehdr; /* File header, not machine dep. */
450 #else
451 AOUTHDR aouthdr; /* a.out header */
452 FILHDR filehdr; /* File header, not machine dep. */
453 #endif
454 long string_table_size; /* names + '\0' + sizeof(int) */
455 long relocation_size; /* Cumulated size of relocation
456 information for all sections in
457 bytes. */
458 long lineno_size; /* Size of the line number information
459 table in bytes */
460 }
461
462 object_headers;
463
464
465
466 struct lineno_list
467 {
468
469 struct bfd_internal_lineno line;
470 char *frag; /* Frag to which the line number is related */
471 struct lineno_list *next; /* Forward chain pointer */
472 };
473
474
475
476
477 /* stack stuff */
478 typedef struct
479 {
480 unsigned long chunk_size;
481 unsigned long element_size;
482 unsigned long size;
483 char *data;
484 unsigned long pointer;
485 }
486
487 stack;
488
489 #define obj_segment_name(i) (segment_info[(int) (i)].scnhdr.s_name)
490
491 #define obj_add_segment(s) obj_coff_add_segment (s)
492
493 extern segT obj_coff_add_segment PARAMS ((const char *));
494
495 extern void obj_coff_section PARAMS ((int));
496
497 extern void c_dot_file_symbol PARAMS ((char *filename));
498 extern void obj_extra_stuff PARAMS ((object_headers * headers));
499 extern void stack_delete PARAMS ((stack * st));
500
501 extern segT s_get_segment PARAMS ((struct symbol * ptr));
502
503 extern void c_section_header PARAMS ((struct internal_scnhdr * header,
504 char *name,
505 long core_address,
506 long size,
507 long data_ptr,
508 long reloc_ptr,
509 long lineno_ptr,
510 long reloc_number,
511 long lineno_number,
512 long alignment));
513
514
515 /* sanity check */
516
517 #ifdef TC_I960
518 #ifndef C_LEAFSTAT
519 hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on it.
520 #endif /* no C_LEAFSTAT */
521 #endif /* TC_I960 */
522 #ifdef BFD_HEADERS
523 extern struct internal_scnhdr data_section_header;
524 extern struct internal_scnhdr text_section_header;
525 #else
526 extern SCNHDR data_section_header;
527 extern SCNHDR text_section_header;
528 #endif
529
530 /* Forward the segment of a forwarded symbol. */
531 #define obj_frob_forward_symbol(symp) \
532 (SF_GET_GET_SEGMENT (symp) \
533 ? (S_SET_SEGMENT (symp, S_GET_SEGMENT (symp->sy_value.X_add_symbol)), 0) \
534 : 0)
535
536 /* Stabs in a coff file go into their own section. */
537
538 #define SEPARATE_STAB_SECTIONS
539
540 /* We need 12 bytes at the start of the section to hold some initial
541 information. */
542
543 extern void obj_coff_init_stab_section PARAMS ((segT));
544
545 #define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg)
546
547 #endif /* OBJ_FORMAT_H */
This page took 0.039646 seconds and 4 git commands to generate.