1 /* coff object file format
2 Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
4 This file is part of GAS.
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)
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.
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. */
24 #if defined (BFD_HEADERS) || defined (BFD_ASSEMBLER)
26 /* This internal_lineno crap is to stop namespace pollution from the
27 bfd internal coff headerfile. */
30 #define internal_lineno bfd_internal_lineno
31 #include "coff/internal.h"
32 #undef internal_lineno
35 #include "../bfd/libcoff.h"
39 #include "coff/a29k.h"
48 #define RELOC struct internal_reloc
49 #define SYMENT struct internal_syment
50 #define AUXENT union internal_auxent
51 #define SCNHDR struct internal_scnhdr
52 #define LINENO struct bfd_internal_lineno
53 #define AOUTHDR struct internal_aouthdr
54 #define FILHDR struct internal_filehdr
55 #define AOUTHDRSZ sizeof(struct external_aouthdr)
57 /*#define x_endndx x_endndx.l
58 #define x_tagndx x_tagndx.l*/
59 #define TARGET_FORMAT "coff-a29k-big"
60 extern bfd
*stdoutput
;
65 #include "coff/i960.h"
66 #define TARGET_FORMAT "coff-i960-big"
70 # include "coff/i386.h"
71 # define TARGET_FORMAT "coff-i386"
72 extern bfd
*stdoutput
;
77 # include "coff/m68k.h"
78 # define TARGET_FORMAT "coff-m68k"
81 #else /* not BFD_HEADERS */
83 #ifdef USE_NATIVE_HEADERS
87 #include <storclass.h>
91 #include <sys/types.h>
92 #else /* not USE_NATIVE_HEADERS */
94 #endif /* not USE_NATIVE_HEADERS */
96 #endif /* not BFD_HEADERS */
99 /* Define some processor dependent values according to the processor
103 #define BYTE_ORDERING F_AR32W /* See filehdr.h for more info. */
104 #ifndef FILE_HEADER_MAGIC
105 #define FILE_HEADER_MAGIC MC68MAGIC /* ... */
106 #endif /* FILE_HEADER_MAGIC */
112 #define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
113 #ifndef FILE_HEADER_MAGIC
114 #define FILE_HEADER_MAGIC I386MAGIC /* ... */
115 #endif /* FILE_HEADER_MAGIC */
121 #define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
122 #ifndef FILE_HEADER_MAGIC
123 #define FILE_HEADER_MAGIC I960ROMAGIC /* ... */
124 #endif /* FILE_HEADER_MAGIC */
130 #define BYTE_ORDERING F_AR32W /* big endian. */
131 #ifndef FILE_HEADER_MAGIC
132 #define FILE_HEADER_MAGIC SIPFBOMAGIC
133 #endif /* FILE_HEADER_MAGIC */
137 #ifndef OBJ_COFF_MAX_AUXENTRIES
138 #define OBJ_COFF_MAX_AUXENTRIES 1
139 #endif /* OBJ_COFF_MAX_AUXENTRIES */
141 extern const short seg_N_TYPE
[];
142 extern const segT N_TYPE_seg
[];
144 /* Magic number of paged executable. */
145 #define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (FILE_HEADER_MAGIC)
149 /* Add these definitions to have a consistent convention for all the
150 types used in COFF format. */
151 #define AOUTHDR struct aouthdr
152 #define AOUTHDRSZ sizeof(AOUTHDR)
155 #endif /* not BFD_ASSEMBLER */
160 /* targets may also set this */
161 #ifndef SYMBOLS_NEED_BACKPOINTERS
162 #define SYMBOLS_NEED_BACKPOINTERS 1
163 #endif /* SYMBOLS_NEED_BACKPOINTERS */
168 #define I960_SYM_FIELDS struct symbol *bal;
170 #define I960_SYM_FIELDS
173 #define TARGET_SYMBOL_FIELDS unsigned long sy_flags; I960_SYM_FIELDS
175 #ifndef OBJ_COFF_MAX_AUXENTRIES
176 #define OBJ_COFF_MAX_AUXENTRIES 1
181 /* Symbol table entry data type */
186 struct internal_syment ost_entry
; /* Basic symbol */
187 union internal_auxent ost_auxent
[OBJ_COFF_MAX_AUXENTRIES
]; /* Auxiliary entry. */
189 SYMENT ost_entry
; /* Basic symbol */
190 AUXENT ost_auxent
[OBJ_COFF_MAX_AUXENTRIES
]; /* Auxiliary entry. */
192 unsigned int ost_flags
; /* obj_coff internal use only flags */
195 #endif /* ! BFD_ASSEMBLER */
198 #define SYM_AUXENT(S) (&coffsymbol ((S)->bsym)->native[1].u.auxent)
200 #define SYM_AUXENT(S) (&(S)->sy_symbol.ost_auxent[0])
203 #define DO_NOT_STRIP 0
206 #ifndef BFD_ASSEMBLER
208 /* Symbol table macros and constants */
210 /* Possible and usefull section number in symbol table
211 * The values of TEXT, DATA and BSS may not be portable.
214 #define C_TEXT_SECTION ((short)1)
215 #define C_DATA_SECTION ((short)2)
216 #define C_BSS_SECTION ((short)3)
217 #define C_ABS_SECTION N_ABS
218 #define C_UNDEF_SECTION N_UNDEF
219 #define C_DEBUG_SECTION N_DEBUG
220 #define C_NTV_SECTION N_TV
221 #define C_PTV_SECTION P_TV
222 #define C_REGISTER_SECTION 4
225 * Macros to extract information from a symbol table entry.
226 * This syntaxic indirection allows independence regarding a.out or coff.
227 * The argument (s) of all these macros is a pointer to a symbol table entry.
231 /* True if the symbol is external */
232 #define S_IS_EXTERNAL(s) ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION)
233 /* True if symbol has been defined, ie :
234 section > 0 (DATA, TEXT or BSS)
235 section == 0 and value > 0 (external bss symbol) */
236 #define S_IS_DEFINED(s) ((s)->sy_symbol.ost_entry.n_scnum > C_UNDEF_SECTION || \
237 ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION && \
239 /* True if a debug special symbol entry */
240 #define S_IS_DEBUG(s) ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
241 /* True if a symbol is local symbol name */
242 /* A symbol name whose name begin with ^A is a gas internal pseudo symbol */
243 #define S_IS_LOCAL(s) (S_GET_NAME(s)[0] == '\001' || \
244 (s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION || \
245 (S_LOCAL_NAME(s) && !flagseen['L']))
246 /* True if a symbol is not defined in this file */
247 #define S_IS_EXTERN(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 \
248 && S_GET_VALUE (s) == 0)
250 * True if a symbol can be multiply defined (bss symbols have this def
251 * though it is bad practice)
253 #define S_IS_COMMON(s) ((s)->sy_symbol.ost_entry.n_scnum == 0
254 && S_GET_VALUE (s
) != 0)
255 /* True if a symbol name is in the string table, i.e. its length is > 8. */
256 #define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
259 /* The name of the symbol */
260 #define S_GET_NAME(s) ((char*)(s)->sy_symbol.ost_entry.n_offset)
261 /* The pointer to the string table */
262 #define S_GET_OFFSET(s) ((s)->sy_symbol.ost_entry.n_offset)
263 /* The zeroes if symbol name is longer than 8 chars */
264 #define S_GET_ZEROES(s) ((s)->sy_symbol.ost_entry.n_zeroes)
265 /* The numeric value of the segment */
266 #define S_GET_SEGMENT(s) (N_TYPE_seg[(s)->sy_symbol.ost_entry.n_scnum+4])
268 #define S_GET_DATA_TYPE(s) ((s)->sy_symbol.ost_entry.n_type)
269 /* The storage class */
270 #define S_GET_STORAGE_CLASS(s) ((s)->sy_symbol.ost_entry.n_sclass)
271 /* The number of auxiliary entries */
272 #define S_GET_NUMBER_AUXILIARY(s) ((s)->sy_symbol.ost_entry.n_numaux)
275 /* Set the name of the symbol */
276 #define S_SET_NAME(s,v) ((s)->sy_symbol.ost_entry.n_offset = (unsigned long)(v))
277 /* Set the offset of the symbol */
278 #define S_SET_OFFSET(s,v) ((s)->sy_symbol.ost_entry.n_offset = (v))
279 /* The zeroes if symbol name is longer than 8 chars */
280 #define S_SET_ZEROES(s,v) ((s)->sy_symbol.ost_entry.n_zeroes = (v))
281 /* The numeric value of the segment */
282 #define S_SET_SEGMENT(s,v) ((s)->sy_symbol.ost_entry.n_scnum = SEGMENT_TO_SYMBOL_TYPE(v))
284 #define S_SET_DATA_TYPE(s,v) ((s)->sy_symbol.ost_entry.n_type = (v))
285 /* The storage class */
286 #define S_SET_STORAGE_CLASS(s,v) ((s)->sy_symbol.ost_entry.n_sclass = (v))
287 /* The number of auxiliary entries */
288 #define S_SET_NUMBER_AUXILIARY(s,v) ((s)->sy_symbol.ost_entry.n_numaux = (v))
290 /* Additional modifiers */
291 /* The symbol is external (does not mean undefined) */
292 #define S_SET_EXTERNAL(s) { S_SET_STORAGE_CLASS(s, C_EXT) ; SF_CLEAR_LOCAL(s); }
294 #else /* BFD_ASSEMBLER */
297 #define S_GET_DATA_TYPE(s) (coffsymbol ((s)->bsym)->native->u.syment.n_type)
298 /* The storage class */
299 #define S_GET_STORAGE_CLASS(s) (coffsymbol((s)->bsym)->native->u.syment.n_sclass)
300 /* The number of auxiliary entries */
301 #define S_GET_NUMBER_AUXILIARY(s) (coffsymbol((s)->bsym)->native->u.syment.n_numaux)
303 #define S_SET_DATA_TYPE(s,v) (S_GET_DATA_TYPE (s) = (v))
304 /* The storage class */
305 #define S_SET_STORAGE_CLASS(s,v) (S_GET_STORAGE_CLASS (s) = (v))
306 /* The number of auxiliary entries */
307 #define S_SET_NUMBER_AUXILIARY(s,v) (S_GET_NUMBER_AUXILIARY (s) = (v))
309 /* True if a symbol name is in the string table, i.e. its length is > 8. */
310 #define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
313 #endif /* ! BFD_ASSEMBLER */
315 /* Auxiliary entry macros. SA_ stands for symbol auxiliary */
316 /* Omit the tv related fields */
320 #define SA_GET_SYM_TAGNDX(s) (SYM_AUXENT (s)->x_sym.x_tagndx.l)
322 #define SA_GET_SYM_TAGNDX(s) (SYM_AUXENT (s)->x_sym.x_tagndx)
324 #define SA_GET_SYM_LNNO(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno)
325 #define SA_GET_SYM_SIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size)
326 #define SA_GET_SYM_FSIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize)
327 #define SA_GET_SYM_LNNOPTR(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr)
329 #define SA_GET_SYM_ENDNDX(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx.l)
331 #define SA_GET_SYM_ENDNDX(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx)
333 #define SA_GET_SYM_DIMEN(s,i) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)])
334 #define SA_GET_FILE_FNAME(s) (SYM_AUXENT (s)->x_file.x_fname)
335 #define SA_GET_SCN_SCNLEN(s) (SYM_AUXENT (s)->x_scn.x_scnlen)
336 #define SA_GET_SCN_NRELOC(s) (SYM_AUXENT (s)->x_scn.x_nreloc)
337 #define SA_GET_SCN_NLINNO(s) (SYM_AUXENT (s)->x_scn.x_nlinno)
340 #ifndef BFD_ASSEMBLER
342 #define SA_SET_SYM_TAGNDX(s,v) (SYM_AUXENT (s)->x_sym.x_tagndx.l=(v))
343 #define SA_SET_SYM_ENDNDX(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx.l=(v))
345 #define SA_SET_SYM_ENDNDX(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx=(v))
346 #define SA_SET_SYM_TAGNDX(s,v) (SYM_AUXENT (s)->x_sym.x_tagndx=(v))
350 #define SA_SET_SYM_LNNO(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno=(v))
351 #define SA_SET_SYM_SIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size=(v))
352 #define SA_SET_SYM_FSIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize=(v))
353 #define SA_SET_SYM_LNNOPTR(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr=(v))
354 #define SA_SET_SYM_DIMEN(s,i,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
355 #define SA_SET_FILE_FNAME(s,v) strncpy(SYM_AUXENT (s)->x_file.x_fname,(v),FILNMLEN)
356 #define SA_SET_SCN_SCNLEN(s,v) (SYM_AUXENT (s)->x_scn.x_scnlen=(v))
357 #define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc=(v))
358 #define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v))
361 * Internal use only definitions. SF_ stands for symbol flags.
363 * These values can be assigned to sy_symbol.ost_flags field of a symbolS.
365 * You'll break i960 if you shift the SYSPROC bits anywhere else. for
366 * more on the balname/callname hack, see tc-i960.h. b.out is done
370 #define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */
371 #define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */
372 #define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */
373 #define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */
374 #define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */
376 #define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */
378 #define SF_STATICS (0x00001000) /* Mark the .text & all symbols */
379 #define SF_DEFINED (0x00002000) /* Symbol is defined in this file */
380 #define SF_STRING (0x00004000) /* Symbol name length > 8 */
381 #define SF_LOCAL (0x00008000) /* Symbol must not be emitted */
383 #define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */
385 #define SF_FUNCTION (0x00010000) /* The symbol is a function */
386 #define SF_PROCESS (0x00020000) /* Process symbol before write */
387 #define SF_TAGGED (0x00040000) /* Is associated with a tag */
388 #define SF_TAG (0x00080000) /* Is a tag */
389 #define SF_DEBUG (0x00100000) /* Is in debug or abs section */
390 #define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */
391 /* All other bits are unused. */
395 #define SF_GET(s) ((s)->sy_flags)
396 #define SF_GET_DEBUG(s) ((s)->bsym->flags & BSF_DEBUGGING)
397 #define SF_SET_DEBUG(s) ((s)->bsym->flags |= BSF_DEBUGGING)
399 #define SF_GET(s) ((s)->sy_symbol.ost_flags)
400 #define SF_GET_DEBUG(s) ((s)->sy_symbol.ost_flags & SF_DEBUG)
401 #define SF_SET_DEBUG(s) ((s)->sy_symbol.ost_flags |= SF_DEBUG)
403 #define SF_GET_NORMAL_FIELD(s) (SF_GET (s) & SF_NORMAL_MASK)
404 #define SF_GET_DEBUG_FIELD(s) (SF_GET (s) & SF_DEBUG_MASK)
405 #define SF_GET_FILE(s) (SF_GET (s) & SF_FILE)
406 #define SF_GET_STATICS(s) (SF_GET (s) & SF_STATICS)
407 #define SF_GET_DEFINED(s) (SF_GET (s) & SF_DEFINED)
408 #define SF_GET_STRING(s) (SF_GET (s) & SF_STRING)
409 #define SF_GET_LOCAL(s) (SF_GET (s) & SF_LOCAL)
410 #define SF_GET_FUNCTION(s) (SF_GET (s) & SF_FUNCTION)
411 #define SF_GET_PROCESS(s) (SF_GET (s) & SF_PROCESS)
412 #define SF_GET_TAGGED(s) (SF_GET (s) & SF_TAGGED)
413 #define SF_GET_TAG(s) (SF_GET (s) & SF_TAG)
414 #define SF_GET_GET_SEGMENT(s) (SF_GET (s) & SF_GET_SEGMENT)
415 #define SF_GET_I960(s) (SF_GET (s) & SF_I960_MASK) /* used by i960 */
416 #define SF_GET_BALNAME(s) (SF_GET (s) & SF_BALNAME) /* used by i960 */
417 #define SF_GET_CALLNAME(s) (SF_GET (s) & SF_CALLNAME) /* used by i960 */
418 #define SF_GET_IS_SYSPROC(s) (SF_GET (s) & SF_IS_SYSPROC) /* used by i960 */
419 #define SF_GET_SYSPROC(s) (SF_GET (s) & SF_SYSPROC) /* used by i960 */
422 #define SF_SET(s,v) (SF_GET (s) = (v))
423 #define SF_SET_NORMAL_FIELD(s,v)(SF_GET (s) |= ((v) & SF_NORMAL_MASK))
424 #define SF_SET_DEBUG_FIELD(s,v) (SF_GET (s) |= ((v) & SF_DEBUG_MASK))
425 #define SF_SET_FILE(s) (SF_GET (s) |= SF_FILE)
426 #define SF_SET_STATICS(s) (SF_GET (s) |= SF_STATICS)
427 #define SF_SET_DEFINED(s) (SF_GET (s) |= SF_DEFINED)
428 #define SF_SET_STRING(s) (SF_GET (s) |= SF_STRING)
429 #define SF_SET_LOCAL(s) (SF_GET (s) |= SF_LOCAL)
430 #define SF_CLEAR_LOCAL(s) (SF_GET (s) &= ~SF_LOCAL)
431 #define SF_SET_FUNCTION(s) (SF_GET (s) |= SF_FUNCTION)
432 #define SF_SET_PROCESS(s) (SF_GET (s) |= SF_PROCESS)
433 #define SF_SET_TAGGED(s) (SF_GET (s) |= SF_TAGGED)
434 #define SF_SET_TAG(s) (SF_GET (s) |= SF_TAG)
435 #define SF_SET_GET_SEGMENT(s) (SF_GET (s) |= SF_GET_SEGMENT)
436 #define SF_SET_I960(s,v) (SF_GET (s) |= ((v) & SF_I960_MASK)) /* used by i960 */
437 #define SF_SET_BALNAME(s) (SF_GET (s) |= SF_BALNAME) /* used by i960 */
438 #define SF_SET_CALLNAME(s) (SF_GET (s) |= SF_CALLNAME) /* used by i960 */
439 #define SF_SET_IS_SYSPROC(s) (SF_GET (s) |= SF_IS_SYSPROC) /* used by i960 */
440 #define SF_SET_SYSPROC(s,v) (SF_GET (s) |= ((v) & SF_SYSPROC)) /* used by i960 */
442 /* File header macro and type definition */
444 #ifndef BFD_ASSEMBLER
446 * File position calculators. Beware to use them when all the
447 * appropriate fields are set in the header.
450 #ifdef OBJ_COFF_OMIT_OPTIONAL_HEADER
451 #define OBJ_COFF_AOUTHDRSZ (0)
453 #define OBJ_COFF_AOUTHDRSZ (AOUTHDRSZ)
454 #endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
456 #define H_GET_FILE_SIZE(h) \
457 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
458 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
459 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
460 H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h) + \
461 H_GET_SYMBOL_TABLE_SIZE(h) + \
462 (h)->string_table_size)
463 #define H_GET_TEXT_FILE_OFFSET(h) \
464 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
465 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)
466 #define H_GET_DATA_FILE_OFFSET(h) \
467 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
468 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
470 #define H_GET_BSS_FILE_OFFSET(h) 0
471 #define H_GET_RELOCATION_FILE_OFFSET(h) \
472 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
473 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
474 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h))
475 #define H_GET_LINENO_FILE_OFFSET(h) \
476 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
477 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
478 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
479 H_GET_RELOCATION_SIZE(h))
480 #define H_GET_SYMBOL_TABLE_FILE_OFFSET(h) \
481 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
482 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
483 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
484 H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h))
488 #define H_GET_MAGIC_NUMBER(h) ((h)->aouthdr.magic)
489 #define H_GET_VERSION_STAMP(h) ((h)->aouthdr.vstamp)
490 #define H_GET_TEXT_SIZE(h) ((h)->aouthdr.tsize)
491 #define H_GET_DATA_SIZE(h) ((h)->aouthdr.dsize)
492 #define H_GET_BSS_SIZE(h) ((h)->aouthdr.bsize)
493 #define H_GET_ENTRY_POINT(h) ((h)->aouthdr.entry)
494 #define H_GET_TEXT_START(h) ((h)->aouthdr.text_start)
495 #define H_GET_DATA_START(h) ((h)->aouthdr.data_start)
497 #define H_GET_FILE_MAGIC_NUMBER(h) ((h)->filehdr.f_magic)
498 #define H_GET_NUMBER_OF_SECTIONS(h) ((h)->filehdr.f_nscns)
499 #define H_GET_TIME_STAMP(h) ((h)->filehdr.f_timdat)
500 #define H_GET_SYMBOL_TABLE_POINTER(h) ((h)->filehdr.f_symptr)
501 #define H_GET_SYMBOL_COUNT(h) ((h)->filehdr.f_nsyms)
502 #define H_GET_SYMBOL_TABLE_SIZE(h) (H_GET_SYMBOL_COUNT(h) * SYMESZ)
503 #define H_GET_SIZEOF_OPTIONAL_HEADER(h) ((h)->filehdr.f_opthdr)
504 #define H_GET_FLAGS(h) ((h)->filehdr.f_flags)
505 /* Extra fields to achieve bsd a.out compatibility and for convenience */
506 #define H_GET_RELOCATION_SIZE(h) ((h)->relocation_size)
507 #define H_GET_STRING_SIZE(h) ((h)->string_table_size)
508 #define H_GET_LINENO_SIZE(h) ((h)->lineno_size)
510 #ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER
511 #define H_GET_HEADER_SIZE(h) (sizeof(FILHDR) \
513 + (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ))
514 #else /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
515 #define H_GET_HEADER_SIZE(h) (sizeof(FILHDR) \
516 + (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ))
517 #endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
519 #define H_GET_TEXT_RELOCATION_SIZE(h) (text_section_header.s_nreloc * RELSZ)
520 #define H_GET_DATA_RELOCATION_SIZE(h) (data_section_header.s_nreloc * RELSZ)
524 #define H_SET_MAGIC_NUMBER(h,v) ((h)->aouthdr.magic = (v))
525 #define H_SET_VERSION_STAMP(h,v) ((h)->aouthdr.vstamp = (v))
526 #define H_SET_TEXT_SIZE(h,v) ((h)->aouthdr.tsize = (v))
527 #define H_SET_DATA_SIZE(h,v) ((h)->aouthdr.dsize = (v))
528 #define H_SET_BSS_SIZE(h,v) ((h)->aouthdr.bsize = (v))
529 #define H_SET_ENTRY_POINT(h,v) ((h)->aouthdr.entry = (v))
530 #define H_SET_TEXT_START(h,v) ((h)->aouthdr.text_start = (v))
531 #define H_SET_DATA_START(h,v) ((h)->aouthdr.data_start = (v))
533 #define H_SET_FILE_MAGIC_NUMBER(h,v) ((h)->filehdr.f_magic = (v))
534 #define H_SET_NUMBER_OF_SECTIONS(h,v) ((h)->filehdr.f_nscns = (v))
535 #define H_SET_TIME_STAMP(h,v) ((h)->filehdr.f_timdat = (v))
536 #define H_SET_SYMBOL_TABLE_POINTER(h,v) ((h)->filehdr.f_symptr = (v))
537 #define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->filehdr.f_nsyms = (v))
538 #define H_SET_SIZEOF_OPTIONAL_HEADER(h,v) ((h)->filehdr.f_opthdr = (v))
539 #define H_SET_FLAGS(h,v) ((h)->filehdr.f_flags = (v))
540 /* Extra fields to achieve bsd a.out compatibility and for convinience */
541 #define H_SET_RELOCATION_SIZE(h,t,d) ((h)->relocation_size = (t)+(d))
542 #define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
543 #define H_SET_LINENO_SIZE(h,v) ((h)->lineno_size = (v))
545 /* Segment flipping */
550 struct internal_aouthdr aouthdr
; /* a.out header */
551 struct internal_filehdr filehdr
; /* File header, not machine dep. */
553 AOUTHDR aouthdr
; /* a.out header */
554 FILHDR filehdr
; /* File header, not machine dep. */
556 long string_table_size
; /* names + '\0' + sizeof(int) */
557 long relocation_size
; /* Cumulated size of relocation
558 information for all sections in
560 long lineno_size
; /* Size of the line number information
565 #endif /* ! BFD_ASSEMBLER */
567 /* -------------- Line number handling ------- */
568 extern int text_lineno_number
;
570 #ifndef BFD_ASSEMBLER
571 /* line numbering stuff. */
573 typedef struct internal_lineno
576 struct bfd_internal_lineno line
;
578 LINENO line
; /* The lineno structure itself */
580 char *frag
; /* Frag to which the line number is related */
581 struct internal_lineno
*next
; /* Forward chain pointer */
584 extern lineno
*lineno_lastP
;
585 extern lineno
*lineno_rootP
;
586 #define OBJ_EMIT_LINENO(a, b, c) obj_emit_lineno((a),(b),(c))
588 #endif /* not BFD_ASSEMBLER */
590 void obj_emit_lineno
PARAMS ((char **where
, lineno
* line
, char *file_start
));
595 unsigned long chunk_size
;
596 unsigned long element_size
;
599 unsigned long pointer
;
604 char *stack_pop
PARAMS ((stack
* st
));
605 char *stack_push
PARAMS ((stack
* st
, char *element
));
606 char *stack_top
PARAMS ((stack
* st
));
607 stack
*stack_init
PARAMS ((unsigned long chunk_size
,
608 unsigned long element_size
));
609 void c_dot_file_symbol
PARAMS ((char *filename
));
610 void obj_extra_stuff
PARAMS ((object_headers
* headers
));
611 void stack_delete
PARAMS ((stack
* st
));
613 #ifndef tc_headers_hook
614 void tc_headers_hook
PARAMS ((object_headers
* headers
));
617 #ifndef tc_coff_symbol_emit_hook
618 void tc_coff_symbol_emit_hook
PARAMS ((/* symbolS * */));
621 #define obj_check_file_symbols coff_check_file_symbols
624 void c_section_header
PARAMS ((
626 struct internal_scnhdr
*header
,
630 char *name
, long core_address
, long size
,
631 long data_ptr
, long reloc_ptr
, long lineno_ptr
,
632 long reloc_number
, long lineno_number
,
640 hey
! Where is the C_LEAFSTAT definition
? i960
- coff support is depending on it
.
641 #endif /* no C_LEAFSTAT */
643 #ifndef BFD_ASSEMBLER
645 extern struct internal_scnhdr data_section_header
;
646 extern struct internal_scnhdr text_section_header
;
648 extern SCNHDR data_section_header
;
649 extern SCNHDR text_section_header
;
653 /* end of obj-coff.h */