| 1 | /* BFD COFF object file private structure. |
| 2 | Copyright (C) 1990-1991 Free Software Foundation, Inc. |
| 3 | Written by Cygnus Support. |
| 4 | |
| 5 | This file is part of BFD, the Binary File Descriptor library. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 20 | |
| 21 | |
| 22 | /* Object file tdata; access macros */ |
| 23 | |
| 24 | #define coff_data(bfd) ((bfd)->tdata.coff_obj_data) |
| 25 | #define exec_hdr(bfd) (coff_data(bfd)->hdr) |
| 26 | #define obj_symbols(bfd) (coff_data(bfd)->symbols) |
| 27 | #define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos) |
| 28 | |
| 29 | #define obj_relocbase(bfd) (coff_data(bfd)->relocbase) |
| 30 | #define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments) |
| 31 | #define obj_convert(bfd) (coff_data(bfd)->conversion_table) |
| 32 | #define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size) |
| 33 | #if CFILE_STUFF |
| 34 | #define obj_symbol_slew(bfd) (coff_data(bfd)->symbol_index_slew) |
| 35 | #else |
| 36 | #define obj_symbol_slew(bfd) 0 |
| 37 | #endif |
| 38 | |
| 39 | |
| 40 | /* `Tdata' information kept for COFF files. */ |
| 41 | |
| 42 | typedef struct coff_tdata |
| 43 | { |
| 44 | struct coff_symbol_struct *symbols; /* symtab for input bfd */ |
| 45 | unsigned int *conversion_table; |
| 46 | int conv_table_size; |
| 47 | file_ptr sym_filepos; |
| 48 | |
| 49 | long symbol_index_slew; /* used during read to mark whether a |
| 50 | C_FILE symbol as been added. */ |
| 51 | |
| 52 | struct coff_ptr_struct *raw_syments; |
| 53 | struct lineno *raw_linenos; |
| 54 | unsigned int raw_syment_count; |
| 55 | unsigned short flags; |
| 56 | |
| 57 | /* These are only valid once writing has begun */ |
| 58 | long int relocbase; |
| 59 | |
| 60 | /* These members communicate important constants about the symbol table |
| 61 | to GDB's symbol-reading code. These `constants' unfortunately vary |
| 62 | from coff implementation to implementation... */ |
| 63 | unsigned local_n_btmask; |
| 64 | unsigned local_n_btshft; |
| 65 | unsigned local_n_tmask; |
| 66 | unsigned local_n_tshift; |
| 67 | unsigned local_symesz; |
| 68 | unsigned local_auxesz; |
| 69 | unsigned local_linesz; |
| 70 | } coff_data_type; |
| 71 | |
| 72 | /* We take the address of the first element of a asymbol to ensure that the |
| 73 | * macro is only ever applied to an asymbol. */ |
| 74 | #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) |
| 75 | |
| 76 | /* Functions in coffgen.c. */ |
| 77 | extern bfd_target *coff_object_p PARAMS ((bfd *)); |
| 78 | extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int)); |
| 79 | extern unsigned int coff_get_symtab_upper_bound PARAMS ((bfd *)); |
| 80 | extern unsigned int coff_get_symtab PARAMS ((bfd *, asymbol **)); |
| 81 | extern void coff_count_linenumbers PARAMS ((bfd *)); |
| 82 | extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *)); |
| 83 | extern void coff_renumber_symbols PARAMS ((bfd *)); |
| 84 | extern void coff_mangle_symbols PARAMS ((bfd *)); |
| 85 | extern void coff_write_symbols PARAMS ((bfd *)); |
| 86 | extern void coff_write_linenumbers PARAMS ((bfd *)); |
| 87 | extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *)); |
| 88 | extern asymbol *coff_section_symbol PARAMS ((bfd *, char *)); |
| 89 | extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *)); |
| 90 | extern unsigned int coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); |
| 91 | extern asymbol *coff_make_empty_symbol PARAMS ((bfd *)); |
| 92 | extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *, |
| 93 | bfd_print_symbol_type how)); |
| 94 | extern asymbol *coff_make_debug_symbol PARAMS ((bfd *, PTR, unsigned long)); |
| 95 | extern boolean coff_find_nearest_line PARAMS ((bfd *, |
| 96 | asection *, |
| 97 | asymbol **, |
| 98 | bfd_vma offset, |
| 99 | CONST char **filename_ptr, |
| 100 | CONST char **functionname_ptr, |
| 101 | unsigned int *line_ptr)); |
| 102 | extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc)); |
| 103 | extern boolean bfd_coff_reloc16_relax_section PARAMS ((bfd *, |
| 104 | asection *, |
| 105 | asymbol **)); |
| 106 | extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents |
| 107 | PARAMS ((bfd *, struct bfd_seclet *, bfd_byte *, boolean relocateable)); |
| 108 | extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *, |
| 109 | struct bfd_seclet *)); |
| 110 | |
| 111 | /* And more taken from the source .. */ |
| 112 | |