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