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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [bfd/] [libxcoff.h] - Blame information for rev 148

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

Line No. Rev Author Line
1 14 khays
/* BFD XCOFF object file private structure.
2
   Copyright 2001, 2002, 2005, 2007, 2009 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
20
   MA 02110-1301, USA.  */
21
 
22
#ifndef LIBXCOFF_H
23
#define LIBXCOFF_H
24
 
25
/* This is the backend information kept for XCOFF files.  This
26
   structure is constant for a particular backend.  The first element
27
   is the COFF backend data structure, so that XCOFF targets can use
28
   the generic COFF code.  */
29
 
30
struct xcoff_backend_data_rec
31
{
32
  /* COFF backend information.  */
33
  bfd_coff_backend_data coff;
34
 
35
  /* Magic number.  */
36
  unsigned short _xcoff_magic_number;
37
 
38
  /* Architecture and machine for coff_set_arch_mach_hook.  */
39
  enum bfd_architecture _xcoff_architecture;
40
  long _xcoff_machine;
41
 
42
  /* Function pointers to xcoff specific swap routines.  */
43
  void (* _xcoff_swap_ldhdr_in) (bfd *, const void *, struct internal_ldhdr *);
44
  void (* _xcoff_swap_ldhdr_out)(bfd *, const struct internal_ldhdr *, void *);
45
  void (* _xcoff_swap_ldsym_in) (bfd *, const void *, struct internal_ldsym *);
46
  void (* _xcoff_swap_ldsym_out)(bfd *, const struct internal_ldsym *, void *);
47
  void (* _xcoff_swap_ldrel_in) (bfd *, const void *, struct internal_ldrel *);
48
  void (* _xcoff_swap_ldrel_out)(bfd *, const struct internal_ldrel *, void *);
49
 
50
  /* Size of the external struct.  */
51
  unsigned int _xcoff_ldhdrsz;
52
  unsigned int _xcoff_ldsymsz;
53
  unsigned int _xcoff_ldrelsz;
54
 
55
  /* Size an entry in a descriptor section.  */
56
  unsigned int _xcoff_function_descriptor_size;
57
 
58
  /* Size of the small aout file header.  */
59
  unsigned int _xcoff_small_aout_header_size;
60
 
61
  /* Loader version
62
     1 : XCOFF32
63
     2 : XCOFF64.  */
64
  unsigned long _xcoff_ldhdr_version;
65
 
66
  bfd_boolean (* _xcoff_put_symbol_name)
67
    (bfd *, struct bfd_strtab_hash *, struct internal_syment *,
68
     const char *);
69
 
70
  bfd_boolean (* _xcoff_put_ldsymbol_name)
71
    (bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
72
     const char *);
73
 
74
  reloc_howto_type *_xcoff_dynamic_reloc;
75
 
76
  asection * (* _xcoff_create_csect_from_smclas)
77
    (bfd *, union internal_auxent *, const char *);
78
 
79
  /* Line number and relocation overflow.
80
     XCOFF32 overflows to another section when the line number or the
81
     relocation count exceeds 0xffff.  XCOFF64 does not overflow.  */
82
  bfd_boolean (*_xcoff_is_lineno_count_overflow) (bfd *, bfd_vma);
83
  bfd_boolean (*_xcoff_is_reloc_count_overflow)  (bfd *, bfd_vma);
84
 
85
  /* Loader section symbol and relocation table offset
86
     XCOFF32 is after the .loader header
87
     XCOFF64 is offset in .loader header.  */
88
  bfd_vma (*_xcoff_loader_symbol_offset) (bfd *, struct internal_ldhdr *);
89
  bfd_vma (*_xcoff_loader_reloc_offset)  (bfd *, struct internal_ldhdr *);
90
 
91
  /* Global linkage.  The first word of global linkage code must be be
92
     modified by filling in the correct TOC offset.  */
93
  unsigned long *_xcoff_glink_code;
94
 
95
  /* Size of the global link code in bytes of the xcoff_glink_code table.  */
96
  unsigned long _xcoff_glink_size;
97
 
98
  /* rtinit.  */
99
  unsigned int _xcoff_rtinit_size;
100
  bfd_boolean (*_xcoff_generate_rtinit)
101
    (bfd *, const char *, const char *, bfd_boolean);
102
};
103
 
104
/* Look up an entry in an XCOFF link hash table.  */
105
#define xcoff_link_hash_lookup(table, string, create, copy, follow) \
106
  ((struct xcoff_link_hash_entry *) \
107
   bfd_link_hash_lookup (&(table)->root, (string), (create), (copy),\
108
                         (follow)))
109
 
110
/* Traverse an XCOFF link hash table.  */
111
#define xcoff_link_hash_traverse(table, func, info)                     \
112
  (bfd_link_hash_traverse                                               \
113
   (&(table)->root,                                                     \
114
    (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func),    \
115
    (info)))
116
 
117
/* Get the XCOFF link hash table from the info structure.  This is
118
   just a cast.  */
119
#define xcoff_hash_table(p) ((struct xcoff_link_hash_table *) ((p)->hash))
120
 
121
 
122
#define xcoff_backend(abfd) \
123
  ((struct xcoff_backend_data_rec *) (abfd)->xvec->backend_data)
124
 
125
#define bfd_xcoff_magic_number(a) ((xcoff_backend (a)->_xcoff_magic_number))
126
#define bfd_xcoff_architecture(a) ((xcoff_backend (a)->_xcoff_architecture))
127
#define bfd_xcoff_machine(a)      ((xcoff_backend (a)->_xcoff_machine))
128
 
129
#define bfd_xcoff_swap_ldhdr_in(a, b, c) \
130
  ((xcoff_backend (a)->_xcoff_swap_ldhdr_in) ((a), (b), (c)))
131
 
132
#define bfd_xcoff_swap_ldhdr_out(a, b, c) \
133
  ((xcoff_backend (a)->_xcoff_swap_ldhdr_out) ((a), (b), (c)))
134
 
135
#define bfd_xcoff_swap_ldsym_in(a, b, c) \
136
  ((xcoff_backend (a)->_xcoff_swap_ldsym_in) ((a), (b), (c)))
137
 
138
#define bfd_xcoff_swap_ldsym_out(a, b, c) \
139
  ((xcoff_backend (a)->_xcoff_swap_ldsym_out) ((a), (b), (c)))
140
 
141
#define bfd_xcoff_swap_ldrel_in(a, b, c) \
142
  ((xcoff_backend (a)->_xcoff_swap_ldrel_in) ((a), (b), (c)))
143
 
144
#define bfd_xcoff_swap_ldrel_out(a, b, c) \
145
  ((xcoff_backend (a)->_xcoff_swap_ldrel_out) ((a), (b), (c)))
146
 
147
#define bfd_xcoff_ldhdrsz(a) ((xcoff_backend (a)->_xcoff_ldhdrsz))
148
#define bfd_xcoff_ldsymsz(a) ((xcoff_backend (a)->_xcoff_ldsymsz))
149
#define bfd_xcoff_ldrelsz(a) ((xcoff_backend (a)->_xcoff_ldrelsz))
150
#define bfd_xcoff_function_descriptor_size(a) \
151
  ((xcoff_backend (a)->_xcoff_function_descriptor_size))
152
#define bfd_xcoff_small_aout_header_size(a) \
153
  ((xcoff_backend (a)->_xcoff_small_aout_header_size))
154
 
155
#define bfd_xcoff_ldhdr_version(a) ((xcoff_backend (a)->_xcoff_ldhdr_version))
156
 
157
#define bfd_xcoff_put_symbol_name(a, b, c, d) \
158
  ((xcoff_backend (a)->_xcoff_put_symbol_name) ((a), (b), (c), (d)))
159
 
160
#define bfd_xcoff_put_ldsymbol_name(a, b, c, d) \
161
  ((xcoff_backend (a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d)))
162
 
163
/* Get the XCOFF hash table entries for a BFD.  */
164
#define obj_xcoff_sym_hashes(bfd) \
165
  ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd))
166
 
167
#define bfd_xcoff_dynamic_reloc_howto(a) \
168
   ((xcoff_backend (a)->_xcoff_dynamic_reloc))
169
 
170
#define bfd_xcoff_create_csect_from_smclas(a, b, c) \
171
   ((xcoff_backend (a)->_xcoff_create_csect_from_smclas((a), (b), (c))))
172
 
173
#define bfd_xcoff_is_lineno_count_overflow(a, b) \
174
   ((xcoff_backend (a)->_xcoff_is_lineno_count_overflow((a), (b))))
175
 
176
#define bfd_xcoff_is_reloc_count_overflow(a, b) \
177
   ((xcoff_backend (a)->_xcoff_is_reloc_count_overflow((a), (b))))
178
 
179
#define bfd_xcoff_loader_symbol_offset(a, b) \
180
 ((xcoff_backend (a)->_xcoff_loader_symbol_offset((a), (b))))
181
 
182
#define bfd_xcoff_loader_reloc_offset(a, b) \
183
 ((xcoff_backend (a)->_xcoff_loader_reloc_offset((a), (b))))
184
 
185
#define bfd_xcoff_glink_code(a, b)   ((xcoff_backend (a)->_xcoff_glink_code[(b)]))
186
#define bfd_xcoff_glink_code_size(a) ((xcoff_backend (a)->_xcoff_glink_size))
187
 
188
/* Check for the magic number U803XTOCMAGIC or U64_TOCMAGIC for 64 bit
189
   targets.  */
190
#define bfd_xcoff_is_xcoff64(a) \
191
  (   (0x01EF == (bfd_xcoff_magic_number (a))) \
192
   || (0x01F7 == (bfd_xcoff_magic_number (a))))
193
 
194
/* Check for the magic number U802TOMAGIC for 32 bit targets.  */
195
#define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number (a)))
196
 
197
#define bfd_xcoff_rtinit_size(a)              ((xcoff_backend (a)->_xcoff_rtinit_size))
198
#define bfd_xcoff_generate_rtinit(a, b, c, d) ((xcoff_backend (a)->_xcoff_generate_rtinit ((a), (b), (c), (d))))
199
 
200
/* Accessor macros for tdata.  */
201
#define bfd_xcoff_text_align_power(a) ((xcoff_data (a)->text_align_power))
202
#define bfd_xcoff_data_align_power(a) ((xcoff_data (a)->data_align_power))
203
 
204
/* xcoff*_ppc_relocate_section macros  */
205
#define XCOFF_MAX_CALCULATE_RELOCATION (0x1c)
206
#define XCOFF_MAX_COMPLAIN_OVERFLOW (4)
207
/* N_ONES produces N one bits, without overflowing machine arithmetic.  */
208
#ifdef N_ONES
209
#undef N_ONES
210
#endif
211
#define N_ONES(n) (((((bfd_vma) 1 << ((n) - 1)) - 1) << 1) | 1)
212
 
213
#define XCOFF_RELOC_FUNCTION_ARGS \
214
  bfd *, asection *, bfd *, struct internal_reloc *, \
215
  struct internal_syment *, struct reloc_howto_struct *, bfd_vma, bfd_vma, \
216
  bfd_vma *relocation, bfd_byte *contents
217
 
218
#define XCOFF_COMPLAIN_FUNCTION_ARGS \
219
  bfd *, bfd_vma, bfd_vma, struct reloc_howto_struct *howto
220
 
221
extern bfd_boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
222
  (XCOFF_RELOC_FUNCTION_ARGS);
223
extern bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
224
  (XCOFF_COMPLAIN_FUNCTION_ARGS);
225
 
226
#define XCOFF_NO_LONG_SECTION_NAMES  (FALSE), bfd_coff_set_long_section_names_disallowed
227
 
228
/* Relocation functions */
229
bfd_boolean xcoff_reloc_type_noop (XCOFF_RELOC_FUNCTION_ARGS);
230
bfd_boolean xcoff_reloc_type_fail (XCOFF_RELOC_FUNCTION_ARGS);
231
bfd_boolean xcoff_reloc_type_pos  (XCOFF_RELOC_FUNCTION_ARGS);
232
bfd_boolean xcoff_reloc_type_neg  (XCOFF_RELOC_FUNCTION_ARGS);
233
bfd_boolean xcoff_reloc_type_rel  (XCOFF_RELOC_FUNCTION_ARGS);
234
bfd_boolean xcoff_reloc_type_toc  (XCOFF_RELOC_FUNCTION_ARGS);
235
bfd_boolean xcoff_reloc_type_ba   (XCOFF_RELOC_FUNCTION_ARGS);
236
bfd_boolean xcoff_reloc_type_crel (XCOFF_RELOC_FUNCTION_ARGS);
237
 
238
/* Structure to describe dwarf sections.
239
   Useful to convert from XCOFF section name to flag and vice-versa.
240
   Also mark if section has a length field at the beginning.  */
241
struct xcoff_dwsect_name {
242
  /* A XCOFF dwarf section is identified by its name.  */
243
  unsigned int flag;
244
 
245
  /* Corresponding XCOFF section name.  */
246
  const char *name;
247
 
248
  /* True if size must be prepended.  */
249
  bfd_boolean def_size;
250
};
251
 
252
/* Number of entries in the array.  The number is known and public so that user
253
   can 'extend' this array by index.  */
254
#define XCOFF_DWSECT_NBR_NAMES  8
255
 
256
/* The dwarf sections array.  */
257
extern const struct xcoff_dwsect_name
258
  xcoff_dwsect_names[XCOFF_DWSECT_NBR_NAMES];
259
 
260
#endif /* LIBXCOFF_H */

powered by: WebSVN 2.1.0

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