* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from
[deliverable/binutils-gdb.git] / bfd / bfd-in.h
1 /* Main header file for the bfd library -- portable access to object files.
2
3 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
4 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
6 Contributed by Cygnus Support.
7
8 This file is part of BFD, the Binary File Descriptor library.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23
24 #ifndef __BFD_H_SEEN__
25 #define __BFD_H_SEEN__
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include "ansidecl.h"
32 #include "symcat.h"
33 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
34 #ifndef SABER
35 /* This hack is to avoid a problem with some strict ANSI C preprocessors.
36 The problem is, "32_" is not a valid preprocessing token, and we don't
37 want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will
38 cause the inner CONCAT2 macros to be evaluated first, producing
39 still-valid pp-tokens. Then the final concatenation can be done. */
40 #undef CONCAT4
41 #define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
42 #endif
43 #endif
44
45 /* The word size used by BFD on the host. This may be 64 with a 32
46 bit target if the host is 64 bit, or if other 64 bit targets have
47 been selected with --enable-targets, or if --enable-64-bit-bfd. */
48 #define BFD_ARCH_SIZE @wordsize@
49
50 /* The word size of the default bfd target. */
51 #define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
52
53 #define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
54 #if @BFD_HOST_64_BIT_DEFINED@
55 #define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
56 #define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
57 #endif
58
59 #if BFD_ARCH_SIZE >= 64
60 #define BFD64
61 #endif
62
63 #ifndef INLINE
64 #if __GNUC__ >= 2
65 #define INLINE __inline__
66 #else
67 #define INLINE
68 #endif
69 #endif
70
71 /* Forward declaration. */
72 typedef struct bfd bfd;
73
74 /* Boolean type used in bfd. Too many systems define their own
75 versions of "boolean" for us to safely typedef a "boolean" of
76 our own. Using an enum for "bfd_boolean" has its own set of
77 problems, with strange looking casts required to avoid warnings
78 on some older compilers. Thus we just use an int.
79
80 General rule: Functions which are bfd_boolean return TRUE on
81 success and FALSE on failure (unless they're a predicate). */
82
83 typedef int bfd_boolean;
84 #undef FALSE
85 #undef TRUE
86 #define FALSE 0
87 #define TRUE 1
88
89 #if 0
90 /* Poison. */
91 #undef false
92 #undef true
93 #define false dont_use_false_in_bfd
94 #define true dont_use_true_in_bfd
95 #endif
96
97 /* Support for different sizes of target format ints and addresses.
98 If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
99 set to 1 above. Otherwise, if gcc is being used, this code will
100 use gcc's "long long" type. Otherwise, BFD_HOST_64_BIT must be
101 defined above. */
102
103 #ifndef BFD_HOST_64_BIT
104 # if BFD_HOST_64BIT_LONG
105 # define BFD_HOST_64_BIT long
106 # define BFD_HOST_U_64_BIT unsigned long
107 # else
108 # ifdef __GNUC__
109 # if __GNUC__ >= 2
110 # define BFD_HOST_64_BIT long long
111 # define BFD_HOST_U_64_BIT unsigned long long
112 # endif /* __GNUC__ >= 2 */
113 # endif /* ! defined (__GNUC__) */
114 # endif /* ! BFD_HOST_64BIT_LONG */
115 #endif /* ! defined (BFD_HOST_64_BIT) */
116
117 #ifdef BFD64
118
119 #ifndef BFD_HOST_64_BIT
120 #error No 64 bit integer type available
121 #endif /* ! defined (BFD_HOST_64_BIT) */
122
123 typedef BFD_HOST_U_64_BIT bfd_vma;
124 typedef BFD_HOST_64_BIT bfd_signed_vma;
125 typedef BFD_HOST_U_64_BIT bfd_size_type;
126 typedef BFD_HOST_U_64_BIT symvalue;
127
128 #ifndef fprintf_vma
129 #if BFD_HOST_64BIT_LONG
130 #define sprintf_vma(s,x) sprintf (s, "%016lx", x)
131 #define fprintf_vma(f,x) fprintf (f, "%016lx", x)
132 #else
133 #define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
134 #define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
135 #define fprintf_vma(s,x) \
136 fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
137 #define sprintf_vma(s,x) \
138 sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
139 #endif
140 #endif
141
142 #else /* not BFD64 */
143
144 /* Represent a target address. Also used as a generic unsigned type
145 which is guaranteed to be big enough to hold any arithmetic types
146 we need to deal with. */
147 typedef unsigned long bfd_vma;
148
149 /* A generic signed type which is guaranteed to be big enough to hold any
150 arithmetic types we need to deal with. Can be assumed to be compatible
151 with bfd_vma in the same way that signed and unsigned ints are compatible
152 (as parameters, in assignment, etc). */
153 typedef long bfd_signed_vma;
154
155 typedef unsigned long symvalue;
156 typedef unsigned long bfd_size_type;
157
158 /* Print a bfd_vma x on stream s. */
159 #define fprintf_vma(s,x) fprintf (s, "%08lx", x)
160 #define sprintf_vma(s,x) sprintf (s, "%08lx", x)
161
162 #endif /* not BFD64 */
163
164 /* A pointer to a position in a file. */
165 /* FIXME: This should be using off_t from <sys/types.h>.
166 For now, try to avoid breaking stuff by not including <sys/types.h> here.
167 This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
168 Probably the best long-term answer is to avoid using file_ptr AND off_t
169 in this header file, and to handle this in the BFD implementation
170 rather than in its interface. */
171 /* typedef off_t file_ptr; */
172 typedef bfd_signed_vma file_ptr;
173 typedef bfd_vma ufile_ptr;
174
175 extern void bfd_sprintf_vma
176 PARAMS ((bfd *, char *, bfd_vma));
177 extern void bfd_fprintf_vma
178 PARAMS ((bfd *, PTR, bfd_vma));
179
180 #define printf_vma(x) fprintf_vma(stdout,x)
181 #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
182
183 typedef unsigned int flagword; /* 32 bits of flags */
184 typedef unsigned char bfd_byte;
185 \f
186 /* File formats. */
187
188 typedef enum bfd_format
189 {
190 bfd_unknown = 0, /* File format is unknown. */
191 bfd_object, /* Linker/assember/compiler output. */
192 bfd_archive, /* Object archive file. */
193 bfd_core, /* Core dump. */
194 bfd_type_end /* Marks the end; don't use it! */
195 }
196 bfd_format;
197
198 /* Values that may appear in the flags field of a BFD. These also
199 appear in the object_flags field of the bfd_target structure, where
200 they indicate the set of flags used by that backend (not all flags
201 are meaningful for all object file formats) (FIXME: at the moment,
202 the object_flags values have mostly just been copied from backend
203 to another, and are not necessarily correct). */
204
205 /* No flags. */
206 #define BFD_NO_FLAGS 0x00
207
208 /* BFD contains relocation entries. */
209 #define HAS_RELOC 0x01
210
211 /* BFD is directly executable. */
212 #define EXEC_P 0x02
213
214 /* BFD has line number information (basically used for F_LNNO in a
215 COFF header). */
216 #define HAS_LINENO 0x04
217
218 /* BFD has debugging information. */
219 #define HAS_DEBUG 0x08
220
221 /* BFD has symbols. */
222 #define HAS_SYMS 0x10
223
224 /* BFD has local symbols (basically used for F_LSYMS in a COFF
225 header). */
226 #define HAS_LOCALS 0x20
227
228 /* BFD is a dynamic object. */
229 #define DYNAMIC 0x40
230
231 /* Text section is write protected (if D_PAGED is not set, this is
232 like an a.out NMAGIC file) (the linker sets this by default, but
233 clears it for -r or -N). */
234 #define WP_TEXT 0x80
235
236 /* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
237 linker sets this by default, but clears it for -r or -n or -N). */
238 #define D_PAGED 0x100
239
240 /* BFD is relaxable (this means that bfd_relax_section may be able to
241 do something) (sometimes bfd_relax_section can do something even if
242 this is not set). */
243 #define BFD_IS_RELAXABLE 0x200
244
245 /* This may be set before writing out a BFD to request using a
246 traditional format. For example, this is used to request that when
247 writing out an a.out object the symbols not be hashed to eliminate
248 duplicates. */
249 #define BFD_TRADITIONAL_FORMAT 0x400
250
251 /* This flag indicates that the BFD contents are actually cached in
252 memory. If this is set, iostream points to a bfd_in_memory struct. */
253 #define BFD_IN_MEMORY 0x800
254
255 /* The sections in this BFD specify a memory page. */
256 #define HAS_LOAD_PAGE 0x1000
257 \f
258 /* Symbols and relocation. */
259
260 /* A count of carsyms (canonical archive symbols). */
261 typedef unsigned long symindex;
262
263 /* How to perform a relocation. */
264 typedef const struct reloc_howto_struct reloc_howto_type;
265
266 #define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
267
268 /* General purpose part of a symbol X;
269 target specific parts are in libcoff.h, libaout.h, etc. */
270
271 #define bfd_get_section(x) ((x)->section)
272 #define bfd_get_output_section(x) ((x)->section->output_section)
273 #define bfd_set_section(x,y) ((x)->section) = (y)
274 #define bfd_asymbol_base(x) ((x)->section->vma)
275 #define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
276 #define bfd_asymbol_name(x) ((x)->name)
277 /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
278 #define bfd_asymbol_bfd(x) ((x)->the_bfd)
279 #define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
280
281 /* A canonical archive symbol. */
282 /* This is a type pun with struct ranlib on purpose! */
283 typedef struct carsym
284 {
285 char *name;
286 file_ptr file_offset; /* Look here to find the file. */
287 }
288 carsym; /* To make these you call a carsymogen. */
289
290 /* Used in generating armaps (archive tables of contents).
291 Perhaps just a forward definition would do? */
292 struct orl /* Output ranlib. */
293 {
294 char **name; /* Symbol name. */
295 union
296 {
297 file_ptr pos;
298 bfd *abfd;
299 } u; /* bfd* or file position. */
300 int namidx; /* Index into string table. */
301 };
302 \f
303 /* Linenumber stuff. */
304 typedef struct lineno_cache_entry
305 {
306 unsigned int line_number; /* Linenumber from start of function. */
307 union
308 {
309 struct symbol_cache_entry *sym; /* Function name. */
310 bfd_vma offset; /* Offset into section. */
311 } u;
312 }
313 alent;
314 \f
315 /* Object and core file sections. */
316
317 #define align_power(addr, align) \
318 (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
319
320 typedef struct sec *sec_ptr;
321
322 #define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
323 #define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
324 #define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
325 #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
326 #define bfd_section_name(bfd, ptr) ((ptr)->name)
327 #define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
328 #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
329 #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
330 #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
331 #define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
332 #define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
333
334 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
335
336 #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
337 #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
338 #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
339
340 typedef struct stat stat_type;
341 \f
342 typedef enum bfd_print_symbol
343 {
344 bfd_print_symbol_name,
345 bfd_print_symbol_more,
346 bfd_print_symbol_all
347 } bfd_print_symbol_type;
348
349 /* Information about a symbol that nm needs. */
350
351 typedef struct _symbol_info
352 {
353 symvalue value;
354 char type;
355 const char *name; /* Symbol name. */
356 unsigned char stab_type; /* Stab type. */
357 char stab_other; /* Stab other. */
358 short stab_desc; /* Stab desc. */
359 const char *stab_name; /* String for stab type. */
360 } symbol_info;
361
362 /* Get the name of a stabs type code. */
363
364 extern const char *bfd_get_stab_name
365 PARAMS ((int));
366 \f
367 /* Hash table routines. There is no way to free up a hash table. */
368
369 /* An element in the hash table. Most uses will actually use a larger
370 structure, and an instance of this will be the first field. */
371
372 struct bfd_hash_entry
373 {
374 /* Next entry for this hash code. */
375 struct bfd_hash_entry *next;
376 /* String being hashed. */
377 const char *string;
378 /* Hash code. This is the full hash code, not the index into the
379 table. */
380 unsigned long hash;
381 };
382
383 /* A hash table. */
384
385 struct bfd_hash_table
386 {
387 /* The hash array. */
388 struct bfd_hash_entry **table;
389 /* The number of slots in the hash table. */
390 unsigned int size;
391 /* A function used to create new elements in the hash table. The
392 first entry is itself a pointer to an element. When this
393 function is first invoked, this pointer will be NULL. However,
394 having the pointer permits a hierarchy of method functions to be
395 built each of which calls the function in the superclass. Thus
396 each function should be written to allocate a new block of memory
397 only if the argument is NULL. */
398 struct bfd_hash_entry *(*newfunc)
399 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
400 /* An objalloc for this hash table. This is a struct objalloc *,
401 but we use PTR to avoid requiring the inclusion of objalloc.h. */
402 PTR memory;
403 };
404
405 /* Initialize a hash table. */
406 extern bfd_boolean bfd_hash_table_init
407 PARAMS ((struct bfd_hash_table *,
408 struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
409 struct bfd_hash_table *,
410 const char *)));
411
412 /* Initialize a hash table specifying a size. */
413 extern bfd_boolean bfd_hash_table_init_n
414 PARAMS ((struct bfd_hash_table *,
415 struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
416 struct bfd_hash_table *,
417 const char *),
418 unsigned int size));
419
420 /* Free up a hash table. */
421 extern void bfd_hash_table_free
422 PARAMS ((struct bfd_hash_table *));
423
424 /* Look up a string in a hash table. If CREATE is TRUE, a new entry
425 will be created for this string if one does not already exist. The
426 COPY argument must be TRUE if this routine should copy the string
427 into newly allocated memory when adding an entry. */
428 extern struct bfd_hash_entry *bfd_hash_lookup
429 PARAMS ((struct bfd_hash_table *, const char *, bfd_boolean create,
430 bfd_boolean copy));
431
432 /* Replace an entry in a hash table. */
433 extern void bfd_hash_replace
434 PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
435 struct bfd_hash_entry *nw));
436
437 /* Base method for creating a hash table entry. */
438 extern struct bfd_hash_entry *bfd_hash_newfunc
439 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
440 const char *));
441
442 /* Grab some space for a hash table entry. */
443 extern PTR bfd_hash_allocate
444 PARAMS ((struct bfd_hash_table *, unsigned int));
445
446 /* Traverse a hash table in a random order, calling a function on each
447 element. If the function returns FALSE, the traversal stops. The
448 INFO argument is passed to the function. */
449 extern void bfd_hash_traverse
450 PARAMS ((struct bfd_hash_table *,
451 bfd_boolean (*) (struct bfd_hash_entry *, PTR),
452 PTR info));
453
454 #define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
455
456 /* User program access to BFD facilities. */
457
458 /* Direct I/O routines, for programs which know more about the object
459 file than BFD does. Use higher level routines if possible. */
460
461 extern bfd_size_type bfd_bread
462 PARAMS ((PTR, bfd_size_type, bfd *));
463 extern bfd_size_type bfd_bwrite
464 PARAMS ((const PTR, bfd_size_type, bfd *));
465 extern int bfd_seek
466 PARAMS ((bfd *, file_ptr, int));
467 extern ufile_ptr bfd_tell
468 PARAMS ((bfd *));
469 extern int bfd_flush
470 PARAMS ((bfd *));
471 extern int bfd_stat
472 PARAMS ((bfd *, struct stat *));
473
474 /* Deprecated old routines. */
475 #if __GNUC__
476 #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
477 (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \
478 bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
479 #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
480 (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \
481 bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
482 #else
483 #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
484 (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
485 bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
486 #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
487 (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
488 bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
489 #endif
490 extern void warn_deprecated
491 PARAMS ((const char *, const char *, int, const char *));
492
493 /* Cast from const char * to char * so that caller can assign to
494 a char * without a warning. */
495 #define bfd_get_filename(abfd) ((char *) (abfd)->filename)
496 #define bfd_get_cacheable(abfd) ((abfd)->cacheable)
497 #define bfd_get_format(abfd) ((abfd)->format)
498 #define bfd_get_target(abfd) ((abfd)->xvec->name)
499 #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
500 #define bfd_family_coff(abfd) \
501 (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
502 bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
503 #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
504 #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
505 #define bfd_header_big_endian(abfd) \
506 ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
507 #define bfd_header_little_endian(abfd) \
508 ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
509 #define bfd_get_file_flags(abfd) ((abfd)->flags)
510 #define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
511 #define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
512 #define bfd_my_archive(abfd) ((abfd)->my_archive)
513 #define bfd_has_map(abfd) ((abfd)->has_armap)
514
515 #define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
516 #define bfd_usrdata(abfd) ((abfd)->usrdata)
517
518 #define bfd_get_start_address(abfd) ((abfd)->start_address)
519 #define bfd_get_symcount(abfd) ((abfd)->symcount)
520 #define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
521 #define bfd_count_sections(abfd) ((abfd)->section_count)
522
523 #define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
524
525 #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
526
527 #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
528
529 extern bfd_boolean bfd_cache_close
530 PARAMS ((bfd *abfd));
531 /* NB: This declaration should match the autogenerated one in libbfd.h. */
532
533 extern bfd_boolean bfd_record_phdr
534 PARAMS ((bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
535 bfd_boolean, bfd_boolean, unsigned int, struct sec **));
536
537 /* Byte swapping routines. */
538
539 bfd_vma bfd_getb64
540 PARAMS ((const unsigned char *));
541 bfd_vma bfd_getl64
542 PARAMS ((const unsigned char *));
543 bfd_signed_vma bfd_getb_signed_64
544 PARAMS ((const unsigned char *));
545 bfd_signed_vma bfd_getl_signed_64
546 PARAMS ((const unsigned char *));
547 bfd_vma bfd_getb32
548 PARAMS ((const unsigned char *));
549 bfd_vma bfd_getl32
550 PARAMS ((const unsigned char *));
551 bfd_signed_vma bfd_getb_signed_32
552 PARAMS ((const unsigned char *));
553 bfd_signed_vma bfd_getl_signed_32
554 PARAMS ((const unsigned char *));
555 bfd_vma bfd_getb16
556 PARAMS ((const unsigned char *));
557 bfd_vma bfd_getl16
558 PARAMS ((const unsigned char *));
559 bfd_signed_vma bfd_getb_signed_16
560 PARAMS ((const unsigned char *));
561 bfd_signed_vma bfd_getl_signed_16
562 PARAMS ((const unsigned char *));
563 void bfd_putb64
564 PARAMS ((bfd_vma, unsigned char *));
565 void bfd_putl64
566 PARAMS ((bfd_vma, unsigned char *));
567 void bfd_putb32
568 PARAMS ((bfd_vma, unsigned char *));
569 void bfd_putl32
570 PARAMS ((bfd_vma, unsigned char *));
571 void bfd_putb16
572 PARAMS ((bfd_vma, unsigned char *));
573 void bfd_putl16
574 PARAMS ((bfd_vma, unsigned char *));
575
576 /* Byte swapping routines which take size and endiannes as arguments. */
577
578 bfd_vma bfd_get_bits
579 PARAMS ((bfd_byte *, int, bfd_boolean));
580 void bfd_put_bits
581 PARAMS ((bfd_vma, bfd_byte *, int, bfd_boolean));
582 \f
583 /* Externally visible ECOFF routines. */
584
585 #if defined(__STDC__) || defined(ALMOST_STDC)
586 struct ecoff_debug_info;
587 struct ecoff_debug_swap;
588 struct ecoff_extr;
589 struct symbol_cache_entry;
590 struct bfd_link_info;
591 struct bfd_link_hash_entry;
592 struct bfd_elf_version_tree;
593 #endif
594 extern bfd_vma bfd_ecoff_get_gp_value
595 PARAMS ((bfd * abfd));
596 extern bfd_boolean bfd_ecoff_set_gp_value
597 PARAMS ((bfd *abfd, bfd_vma gp_value));
598 extern bfd_boolean bfd_ecoff_set_regmasks
599 PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
600 unsigned long *cprmask));
601 extern PTR bfd_ecoff_debug_init
602 PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
603 const struct ecoff_debug_swap *output_swap,
604 struct bfd_link_info *));
605 extern void bfd_ecoff_debug_free
606 PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
607 const struct ecoff_debug_swap *output_swap,
608 struct bfd_link_info *));
609 extern bfd_boolean bfd_ecoff_debug_accumulate
610 PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
611 const struct ecoff_debug_swap *output_swap,
612 bfd *input_bfd, struct ecoff_debug_info *input_debug,
613 const struct ecoff_debug_swap *input_swap,
614 struct bfd_link_info *));
615 extern bfd_boolean bfd_ecoff_debug_accumulate_other
616 PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
617 const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
618 struct bfd_link_info *));
619 extern bfd_boolean bfd_ecoff_debug_externals
620 PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
621 const struct ecoff_debug_swap *swap,
622 bfd_boolean relocateable,
623 bfd_boolean (*get_extr) (struct symbol_cache_entry *,
624 struct ecoff_extr *),
625 void (*set_index) (struct symbol_cache_entry *,
626 bfd_size_type)));
627 extern bfd_boolean bfd_ecoff_debug_one_external
628 PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
629 const struct ecoff_debug_swap *swap,
630 const char *name, struct ecoff_extr *esym));
631 extern bfd_size_type bfd_ecoff_debug_size
632 PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
633 const struct ecoff_debug_swap *swap));
634 extern bfd_boolean bfd_ecoff_write_debug
635 PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
636 const struct ecoff_debug_swap *swap, file_ptr where));
637 extern bfd_boolean bfd_ecoff_write_accumulated_debug
638 PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
639 const struct ecoff_debug_swap *swap,
640 struct bfd_link_info *info, file_ptr where));
641 extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs
642 PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
643 char **));
644
645 /* Externally visible ELF routines. */
646
647 struct bfd_link_needed_list
648 {
649 struct bfd_link_needed_list *next;
650 bfd *by;
651 const char *name;
652 };
653
654 extern bfd_boolean bfd_elf_record_link_assignment
655 PARAMS ((bfd *, struct bfd_link_info *, const char *, bfd_boolean));
656 extern struct bfd_link_needed_list *bfd_elf_get_needed_list
657 PARAMS ((bfd *, struct bfd_link_info *));
658 extern bfd_boolean bfd_elf_get_bfd_needed_list
659 PARAMS ((bfd *, struct bfd_link_needed_list **));
660 extern bfd_boolean bfd_elf32_size_dynamic_sections
661 PARAMS ((bfd *, const char *, const char *, const char *,
662 const char * const *, struct bfd_link_info *, struct sec **,
663 struct bfd_elf_version_tree *));
664 extern bfd_boolean bfd_elf64_size_dynamic_sections
665 PARAMS ((bfd *, const char *, const char *, const char *,
666 const char * const *, struct bfd_link_info *, struct sec **,
667 struct bfd_elf_version_tree *));
668 extern void bfd_elf_set_dt_needed_name
669 PARAMS ((bfd *, const char *));
670 extern void bfd_elf_set_dt_needed_soname
671 PARAMS ((bfd *, const char *));
672 extern const char *bfd_elf_get_dt_soname
673 PARAMS ((bfd *));
674 extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
675 PARAMS ((bfd *, struct bfd_link_info *));
676 extern bfd_boolean bfd_elf32_discard_info
677 PARAMS ((bfd *, struct bfd_link_info *));
678 extern bfd_boolean bfd_elf64_discard_info
679 PARAMS ((bfd *, struct bfd_link_info *));
680
681 /* Return an upper bound on the number of bytes required to store a
682 copy of ABFD's program header table entries. Return -1 if an error
683 occurs; bfd_get_error will return an appropriate code. */
684 extern long bfd_get_elf_phdr_upper_bound
685 PARAMS ((bfd *abfd));
686
687 /* Copy ABFD's program header table entries to *PHDRS. The entries
688 will be stored as an array of Elf_Internal_Phdr structures, as
689 defined in include/elf/internal.h. To find out how large the
690 buffer needs to be, call bfd_get_elf_phdr_upper_bound.
691
692 Return the number of program header table entries read, or -1 if an
693 error occurs; bfd_get_error will return an appropriate code. */
694 extern int bfd_get_elf_phdrs
695 PARAMS ((bfd *abfd, void *phdrs));
696
697 /* Return the arch_size field of an elf bfd, or -1 if not elf. */
698 extern int bfd_get_arch_size
699 PARAMS ((bfd *));
700
701 /* Return TRUE if address "naturally" sign extends, or -1 if not elf. */
702 extern int bfd_get_sign_extend_vma
703 PARAMS ((bfd *));
704
705 extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
706 PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
707 char **));
708 extern bfd_boolean bfd_mips_elf32_create_embedded_relocs
709 PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
710 char **));
711
712 /* SunOS shared library support routines for the linker. */
713
714 extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
715 PARAMS ((bfd *, struct bfd_link_info *));
716 extern bfd_boolean bfd_sunos_record_link_assignment
717 PARAMS ((bfd *, struct bfd_link_info *, const char *));
718 extern bfd_boolean bfd_sunos_size_dynamic_sections
719 PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
720 struct sec **));
721
722 /* Linux shared library support routines for the linker. */
723
724 extern bfd_boolean bfd_i386linux_size_dynamic_sections
725 PARAMS ((bfd *, struct bfd_link_info *));
726 extern bfd_boolean bfd_m68klinux_size_dynamic_sections
727 PARAMS ((bfd *, struct bfd_link_info *));
728 extern bfd_boolean bfd_sparclinux_size_dynamic_sections
729 PARAMS ((bfd *, struct bfd_link_info *));
730
731 /* mmap hacks */
732
733 struct _bfd_window_internal;
734 typedef struct _bfd_window_internal bfd_window_internal;
735
736 typedef struct _bfd_window
737 {
738 /* What the user asked for. */
739 PTR data;
740 bfd_size_type size;
741 /* The actual window used by BFD. Small user-requested read-only
742 regions sharing a page may share a single window into the object
743 file. Read-write versions shouldn't until I've fixed things to
744 keep track of which portions have been claimed by the
745 application; don't want to give the same region back when the
746 application wants two writable copies! */
747 struct _bfd_window_internal *i;
748 }
749 bfd_window;
750
751 extern void bfd_init_window
752 PARAMS ((bfd_window *));
753 extern void bfd_free_window
754 PARAMS ((bfd_window *));
755 extern bfd_boolean bfd_get_file_window
756 PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean));
757
758 /* XCOFF support routines for the linker. */
759
760 extern bfd_boolean bfd_xcoff_link_record_set
761 PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
762 bfd_size_type));
763 extern bfd_boolean bfd_xcoff_import_symbol
764 PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
765 bfd_vma, const char *, const char *, const char *, unsigned int));
766 extern bfd_boolean bfd_xcoff_export_symbol
767 PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
768 extern bfd_boolean bfd_xcoff_link_count_reloc
769 PARAMS ((bfd *, struct bfd_link_info *, const char *));
770 extern bfd_boolean bfd_xcoff_record_link_assignment
771 PARAMS ((bfd *, struct bfd_link_info *, const char *));
772 extern bfd_boolean bfd_xcoff_size_dynamic_sections
773 PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
774 unsigned long, unsigned long, unsigned long, bfd_boolean,
775 int, bfd_boolean, bfd_boolean, struct sec **, bfd_boolean));
776 extern bfd_boolean bfd_xcoff_link_generate_rtinit
777 PARAMS ((bfd *, const char *, const char *, bfd_boolean));
778
779 /* XCOFF support routines for ar. */
780 extern bfd_boolean bfd_xcoff_ar_archive_set_magic
781 PARAMS ((bfd *, char *));
782
783 /* Externally visible COFF routines. */
784
785 #if defined(__STDC__) || defined(ALMOST_STDC)
786 struct internal_syment;
787 union internal_auxent;
788 #endif
789
790 extern bfd_boolean bfd_coff_get_syment
791 PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
792
793 extern bfd_boolean bfd_coff_get_auxent
794 PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
795
796 extern bfd_boolean bfd_coff_set_symbol_class
797 PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
798
799 extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
800 PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
801 char **));
802
803 /* ARM Interworking support. Called from linker. */
804 extern bfd_boolean bfd_arm_allocate_interworking_sections
805 PARAMS ((struct bfd_link_info *));
806
807 extern bfd_boolean bfd_arm_process_before_allocation
808 PARAMS ((bfd *, struct bfd_link_info *, int));
809
810 extern bfd_boolean bfd_arm_get_bfd_for_interworking
811 PARAMS ((bfd *, struct bfd_link_info *));
812
813 /* PE ARM Interworking support. Called from linker. */
814 extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
815 PARAMS ((struct bfd_link_info *));
816
817 extern bfd_boolean bfd_arm_pe_process_before_allocation
818 PARAMS ((bfd *, struct bfd_link_info *, int));
819
820 extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
821 PARAMS ((bfd *, struct bfd_link_info *));
822
823 /* ELF ARM Interworking support. Called from linker. */
824 extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
825 PARAMS ((struct bfd_link_info *));
826
827 extern bfd_boolean bfd_elf32_arm_process_before_allocation
828 PARAMS ((bfd *, struct bfd_link_info *, int));
829
830 extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
831 PARAMS ((bfd *, struct bfd_link_info *));
832
833 extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
834 PARAMS ((bfd *, struct bfd_link_info *));
835
836 /* ARM Note section processing. */
837 extern bfd_boolean bfd_arm_merge_machines
838 PARAMS ((bfd *, bfd *));
839
840 extern bfd_boolean bfd_arm_update_notes
841 PARAMS ((bfd *, const char *));
842
843 extern unsigned int bfd_arm_get_mach_from_notes
844 PARAMS ((bfd *, const char *));
845
846 /* TI COFF load page support. */
847 extern void bfd_ticoff_set_section_load_page
848 PARAMS ((struct sec *, int));
849
850 extern int bfd_ticoff_get_section_load_page
851 PARAMS ((struct sec *));
852
This page took 0.05209 seconds and 4 git commands to generate.