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