OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [bfd/] [libxcoff.h] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* BFD XCOFF object file private structure.
2
   Copyright (C) 2001 Free Software Foundation, Inc.
3
   Written by Tom Rix, Redhat.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
 
21
#ifndef LIBXCOFF_H
22
#define LIBXCOFF_H
23
 
24
/* This is the backend information kept for XCOFF files.  This
25
   structure is constant for a particular backend.  The first element
26
   is the COFF backend data structure, so that XCOFF targets can use
27
   the generic COFF code.  */
28
 
29
struct xcoff_backend_data_rec
30
{
31
  /*
32
   * COFF backend information.  Must be the first field.
33
   * This is where the std coff swap table goes
34
   */
35
  bfd_coff_backend_data coff;
36
 
37
  /* Magic number */
38
  unsigned short _xcoff_magic_number;
39
 
40
  /* Architecture and machine for coff_set_arch_mach_hook */
41
  enum bfd_architecture _xcoff_architecture;
42
  long _xcoff_machine;
43
 
44
  /* function pointers to xcoff specific swap routines */
45
  void (* _xcoff_swap_ldhdr_in)(bfd *, PTR, struct internal_ldhdr *);
46
  void (* _xcoff_swap_ldhdr_out)(bfd *, struct internal_ldhdr *, PTR);
47
  void (* _xcoff_swap_ldsym_in)(bfd *, PTR, struct internal_ldsym *);
48
  void (* _xcoff_swap_ldsym_out)(bfd *, struct internal_ldsym *, PTR);
49
  void (* _xcoff_swap_ldrel_in)(bfd *, PTR, struct internal_ldrel *);
50
  void (* _xcoff_swap_ldrel_out)(bfd *, struct internal_ldrel *, PTR);
51
 
52
  /* size of the the external struct */
53
  unsigned int _xcoff_ldhdrsz;
54
  unsigned int _xcoff_ldsymsz;
55
  unsigned int _xcoff_ldrelsz;
56
 
57
  /* size an entry in a descriptor section */
58
  unsigned int _xcoff_function_descriptor_size;
59
 
60
  /* size of the small aout file header */
61
  unsigned int _xcoff_small_aout_header_size;
62
 
63
  /*
64
   * version
65
   * loader version
66
   * 1 : xcoff32
67
   * 2 : xcoff64
68
   */
69
  unsigned long _xcoff_ldhdr_version;
70
 
71
  boolean (* _xcoff_put_symbol_name)(bfd *, struct bfd_strtab_hash *,
72
                                     struct internal_syment *,
73
                                     const char *);
74
 
75
  boolean (* _xcoff_put_ldsymbol_name)(bfd *, struct xcoff_loader_info *,
76
                                       struct internal_ldsym *,
77
                                       const char *);
78
 
79
  reloc_howto_type *_xcoff_dynamic_reloc;
80
 
81
  asection * (* _xcoff_create_csect_from_smclas) (bfd *, union internal_auxent *, const char *);
82
 
83
  /*
84
   * line_no and reloc overflow
85
   * 32 overflows to another section when the line_no or reloc count go
86
   * over 0xffff.  64 does not overflow.
87
   */
88
  boolean (*_xcoff_is_lineno_count_overflow)(bfd *, bfd_vma);
89
  boolean (*_xcoff_is_reloc_count_overflow)(bfd *, bfd_vma);
90
 
91
  /*
92
   * .loader symbol table offset
93
   * 32 is after the .loader header
94
   * 64 is offset in .loader header
95
   *
96
   * Similar for the reloc table
97
   */
98
  bfd_vma (*_xcoff_loader_symbol_offset)(bfd *, struct internal_ldhdr *);
99
  bfd_vma (*_xcoff_loader_reloc_offset)(bfd *, struct internal_ldhdr *);
100
 
101
 
102
  /*
103
   * Global linkage
104
   *
105
   * The first word of global linkage code must be be modified by
106
   * filling in the correct TOC offset.
107
   */
108
  unsigned long *_xcoff_glink_code;
109
 
110
  /*
111
   * Size of the global link code in bytes of the xcoff_glink_code table
112
   */
113
  unsigned long _xcoff_glink_size;
114
 
115
};
116
 
117
/* Look up an entry in an XCOFF link hash table.  */
118
 
119
#define xcoff_link_hash_lookup(table, string, create, copy, follow) \
120
  ((struct xcoff_link_hash_entry *) \
121
   bfd_link_hash_lookup (&(table)->root, (string), (create), (copy),\
122
                         (follow)))
123
 
124
/* Traverse an XCOFF link hash table.  */
125
 
126
#define xcoff_link_hash_traverse(table, func, info)                     \
127
  (bfd_link_hash_traverse                                               \
128
   (&(table)->root,                                                     \
129
    (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),  \
130
    (info)))
131
 
132
/* Get the XCOFF link hash table from the info structure.  This is
133
   just a cast.  */
134
 
135
#define xcoff_hash_table(p) ((struct xcoff_link_hash_table *) ((p)->hash))
136
 
137
 
138
#define xcoff_backend(abfd) \
139
  ((struct xcoff_backend_data_rec *) (abfd)->xvec->backend_data)
140
 
141
#define bfd_xcoff_magic_number(a) ((xcoff_backend(a)->_xcoff_magic_number))
142
#define bfd_xcoff_architecture(a) ((xcoff_backend(a)->_xcoff_architecture))
143
#define bfd_xcoff_machine(a) ((xcoff_backend(a)->_xcoff_machine))
144
 
145
#define bfd_xcoff_swap_ldhdr_in(a, b, c) \
146
  ((xcoff_backend(a)->_xcoff_swap_ldhdr_in) ((a), (b), (c)))
147
 
148
#define bfd_xcoff_swap_ldhdr_out(a, b, c) \
149
  ((xcoff_backend(a)->_xcoff_swap_ldhdr_out) ((a), (b), (c)))
150
 
151
#define bfd_xcoff_swap_ldsym_in(a, b, c) \
152
  ((xcoff_backend(a)->_xcoff_swap_ldsym_in) ((a), (b), (c)))
153
 
154
#define bfd_xcoff_swap_ldsym_out(a, b, c) \
155
  ((xcoff_backend(a)->_xcoff_swap_ldsym_out) ((a), (b), (c)))
156
 
157
#define bfd_xcoff_swap_ldrel_in(a, b, c) \
158
  ((xcoff_backend(a)->_xcoff_swap_ldrel_in) ((a), (b), (c)))
159
 
160
#define bfd_xcoff_swap_ldrel_out(a, b, c) \
161
  ((xcoff_backend(a)->_xcoff_swap_ldrel_out) ((a), (b), (c)))
162
 
163
#define bfd_xcoff_ldhdrsz(a) ((xcoff_backend(a)->_xcoff_ldhdrsz))
164
#define bfd_xcoff_ldsymsz(a) ((xcoff_backend(a)->_xcoff_ldsymsz))
165
#define bfd_xcoff_ldrelsz(a) ((xcoff_backend(a)->_xcoff_ldrelsz))
166
#define bfd_xcoff_function_descriptor_size(a) \
167
  ((xcoff_backend(a)->_xcoff_function_descriptor_size))
168
#define bfd_xcoff_small_aout_header_size(a) \
169
  ((xcoff_backend(a)->_xcoff_small_aout_header_size))
170
 
171
#define bfd_xcoff_ldhdr_version(a) ((xcoff_backend(a)->_xcoff_ldhdr_version))
172
 
173
#define bfd_xcoff_put_symbol_name(a, b, c, d) \
174
  ((xcoff_backend(a)->_xcoff_put_symbol_name) ((a), (b), (c), (d)))
175
 
176
#define bfd_xcoff_put_ldsymbol_name(a, b, c, d) \
177
  ((xcoff_backend(a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d)))
178
 
179
/* Get the XCOFF hash table entries for a BFD.  */
180
#define obj_xcoff_sym_hashes(bfd) \
181
  ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd))
182
 
183
#define bfd_xcoff_dynamic_reloc_howto(a) \
184
   ((xcoff_backend(a)->_xcoff_dynamic_reloc))
185
 
186
#define bfd_xcoff_create_csect_from_smclas(a, b, c) \
187
   ((xcoff_backend(a)->_xcoff_create_csect_from_smclas((a), (b), (c))))
188
 
189
#define bfd_xcoff_is_lineno_count_overflow(a, b) \
190
   ((xcoff_backend(a)->_xcoff_is_lineno_count_overflow((a), (b))))
191
 
192
#define bfd_xcoff_is_reloc_count_overflow(a, b) \
193
   ((xcoff_backend(a)->_xcoff_is_reloc_count_overflow((a), (b))))
194
 
195
#define bfd_xcoff_loader_symbol_offset(a, b) \
196
 ((xcoff_backend(a)->_xcoff_loader_symbol_offset((a), (b))))
197
 
198
#define bfd_xcoff_loader_reloc_offset(a, b) \
199
 ((xcoff_backend(a)->_xcoff_loader_reloc_offset((a), (b))))
200
 
201
#define bfd_xcoff_glink_code(a, b) ((xcoff_backend(a)->_xcoff_glink_code[(b)]))
202
#define bfd_xcoff_glink_code_size(a) ((xcoff_backend(a)->_xcoff_glink_size))
203
 
204
#define bfd_xcoff_is_xcoff64(a) (0x01EF == (bfd_xcoff_magic_number(a)))
205
#define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number(a)))
206
 
207
/* Functions in xcofflink.c.  */
208
 
209
extern long _bfd_xcoff_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
210
extern long _bfd_xcoff_canonicalize_dynamic_symtab
211
  PARAMS ((bfd *, asymbol **));
212
extern long _bfd_xcoff_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
213
extern long _bfd_xcoff_canonicalize_dynamic_reloc
214
  PARAMS ((bfd *, arelent **, asymbol **));
215
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
216
  PARAMS ((bfd *));
217
extern boolean _bfd_xcoff_bfd_link_add_symbols
218
  PARAMS ((bfd *, struct bfd_link_info *));
219
extern boolean _bfd_xcoff_bfd_final_link
220
  PARAMS ((bfd *, struct bfd_link_info *));
221
extern boolean _bfd_xcoff_slurp_symbol_table
222
  PARAMS ((bfd *));
223
extern long _bfd_xcoff_get_symbol_table
224
  PARAMS ((bfd *, asymbol **));
225
extern asymbol *_bfd_xcoff_make_empty_symbol
226
  PARAMS ((bfd *));
227
extern long _bfd_xcoff_get_symbol_table_upper_bound
228
  PARAMS ((bfd *));
229
extern void _bfd_xcoff_print_symbol
230
  PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
231
extern void _bfd_xcoff_get_symbol_info
232
  PARAMS ((bfd *, asymbol *, symbol_info *));
233
extern long _bfd_xcoff_canonicalize_reloc
234
  PARAMS((bfd *, sec_ptr, arelent **, asymbol **));
235
extern reloc_howto_type *_bfd_xcoff_rtype_to_howto
236
  PARAMS ((bfd *, asection *, struct internal_reloc *,
237
           struct coff_link_hash_entry *, struct internal_syment *,
238
           bfd_vma *));
239
extern boolean _bfd_xcoff_set_section_contents
240
  PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
241
boolean _bfd_xcoff_write_object_contents PARAMS ((bfd *));
242
 
243
 
244
/* XCOFF support routines for the linker.  */
245
 
246
extern boolean bfd_xcoff_link_record_set
247
  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
248
           bfd_size_type));
249
extern boolean bfd_xcoff_import_symbol
250
  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
251
           bfd_vma, const char *, const char *, const char *));
252
extern boolean bfd_xcoff_export_symbol
253
  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
254
           boolean));
255
extern boolean bfd_xcoff_link_count_reloc
256
  PARAMS ((bfd *, struct bfd_link_info *, const char *));
257
extern boolean bfd_xcoff_record_link_assignment
258
  PARAMS ((bfd *, struct bfd_link_info *, const char *));
259
extern boolean bfd_xcoff_size_dynamic_sections
260
  PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
261
           unsigned long, unsigned long, unsigned long, boolean,
262
           int, boolean, boolean, struct sec **));
263
extern boolean xcoff_slurp_reloc_table
264
  PARAMS ((bfd *, asection *, asymbol **));
265
 
266
#endif /* LIBXCOFF_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.