Fixed all the places where there were problems with the size and
[external/binutils.git] / bfd / libcoff.h
1 /* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
2
3 This file is part of BFD, the Binary File Diddler.
4
5 BFD is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 1, or (at your option)
8 any later version.
9
10 BFD is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with BFD; see the file COPYING.  If not, write to
17 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
18
19 /* $Id$ */
20
21 /* BFD COFF object file private structure.  */
22
23 /* Object file tdata; access macros */
24
25 #define obj_icof(bfd)           ((struct icofdata *) ((bfd)->tdata))
26 #define coff_data(bfd)          ((struct icofdata *) ((bfd)->tdata))
27 #define exec_hdr(bfd)           (obj_icof(bfd)->hdr)
28 #define obj_symbols(bfd)        (obj_icof(bfd)->symbols)
29 #define obj_sym_filepos(bfd)    (obj_icof(bfd)->sym_filepos)
30
31 #define obj_relocbase(bfd)      (obj_icof(bfd)->relocbase)
32 #define obj_raw_syments(bfd)    (obj_icof(bfd)->raw_syments)
33 #define obj_convert(bfd)        (obj_icof(bfd)->conversion_table)
34 #if CFILE_STUFF
35 #define obj_symbol_slew(bfd)    (obj_icof(bfd)->symbol_index_slew)
36 #else
37 #define obj_symbol_slew(bfd) 0
38 #endif
39 #define obj_string_table(bfd)   (obj_icof(bfd)->string_table)
40
41 typedef struct {
42   asymbol symbol;
43   struct internal_syment *native;
44   struct lineno_cache_entry *lineno;
45 } coff_symbol_type;
46
47 typedef struct icofdata 
48 {
49   struct aouthdr hdr;           /* exec file header */
50   coff_symbol_type  *symbols;   /* symtab for input bfd */
51   unsigned int *conversion_table;
52   file_ptr sym_filepos;
53
54   long symbol_index_slew;       /* used during read to mark whether a
55                                    C_FILE symbol as been added. */
56
57   struct internal_syment *raw_syments;
58   struct lineno *raw_linenos;
59   unsigned int raw_syment_count;
60   char *string_table;
61   unsigned short flags;
62   /* These are only valid once writing has begun */
63   long int relocbase;
64 } coff_data_type;
65
66 /* We take the address of the first element of a asymbol to ensure that the
67  * macro is only ever applied to an asymbol.  */
68 #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
69
70
71 /* Generic COFF swapping routines -- also used by GDB.  */
72 PROTO (void, bfd_coff_swap_sym, (bfd *, SYMENT *));
73 PROTO (void, bfd_coff_swap_aux, (bfd *, AUXENT *, int, int));
74 PROTO (void, bfd_coff_swap_lineno, (bfd *, LINENO *));