Update to include djm's new stuff.
[deliverable/binutils-gdb.git] / include / bfd.h
CommitLineData
18fe0e9f
JG
1/* Main header file for the bfd library -- portable access to object files.
2 ==> The bfd.h file is generated from bfd-in.h and various .c files; if you
3 ==> change it, your changes will probably be lost.
57486089 4 Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
095c7223 5 Contributed by Cygnus Support.
a07cc613 6
2c346475 7This file is part of BFD, the Binary File Descriptor library.
a07cc613 8
095c7223 9This program is free software; you can redistribute it and/or modify
a07cc613 10it under the terms of the GNU General Public License as published by
095c7223
JG
11the Free Software Foundation; either version 2 of the License, or
12(at your option) any later version.
a07cc613 13
095c7223 14This program is distributed in the hope that it will be useful,
a07cc613
JG
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
095c7223
JG
20along with this program; if not, write to the Free Software
21Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
22
23/* bfd.h -- The only header file required by users of the bfd library
24
18fe0e9f
JG
25The bfd.h file is generated from bfd-in.h and various .c files; if you
26change it, your changes will probably be lost.
095c7223
JG
27
28All the prototypes and definitions following the comment "THE FOLLOWING
29IS EXTRACTED FROM THE SOURCE" are extracted from the source files for
30BFD. If you change it, someone oneday will extract it from the source
31again, and your changes will be lost. To save yourself from this bind,
32change the definitions in the source in the bfd directory. Type "make
33docs" and then "make headers" in that directory, and magically this file
34will change to reflect your changes.
35
36If you don't have the tools to perform the extraction, then you are
37safe from someone on your system trampling over your header files.
38You should still maintain the equivalence between the source and this
39file though; every change you make to the .c file should be reflected
40here. */
a07cc613 41
a07cc613
JG
42#ifndef __BFD_H_SEEN__
43#define __BFD_H_SEEN__
44
45#include "ansidecl.h"
46#include "obstack.h"
47
89d42788 48#define BFD_VERSION "2.2"
ec08b077 49
a07cc613 50/* forward declaration */
9c6a9c92 51typedef struct _bfd bfd;
a07cc613 52
882885d3
SG
53/* To squelch erroneous compiler warnings ("illegal pointer
54 combination") from the SVR3 compiler, we would like to typedef
55 boolean to int (it doesn't like functions which return boolean.
56 Making sure they are never implicitly declared to return int
57 doesn't seem to help). But this file is not configured based on
58 the host. */
ec08b077
JG
59/* General rules: functions which are boolean return true on success
60 and false on failure (unless they're a predicate). -- bfd.doc */
a07cc613
JG
61/* I'm sure this is going to break something and someone is going to
62 force me to change it. */
f7cfc4a6
JG
63/* typedef enum boolean {false, true} boolean; */
64/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
65typedef enum bfd_boolean {false, true} boolean;
a07cc613 66
c98d03ea
JG
67/* A pointer to a position in a file. */
68/* FIXME: This should be using off_t from <sys/types.h>.
69 For now, try to avoid breaking stuff by not including <sys/types.h> here.
70 This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
71 Probably the best long-term answer is to avoid using file_ptr AND off_t
72 in this header file, and to handle this in the BFD implementation
73 rather than in its interface. */
74/* typedef off_t file_ptr; */
75typedef long int file_ptr;
a07cc613 76
14e3c2e4
JK
77/* Support for different sizes of target format ints and addresses.
78 If the host implements--and wants BFD to use--64-bit values, it
79 defines HOST_64_BIT (in BFD and in every program that calls it --
80 since this affects declarations in bfd.h). */
19b03b7a 81
9b9c5c39 82#ifdef HOST_64_BIT
14e3c2e4
JK
83typedef unsigned HOST_64_BIT bfd_vma;
84typedef HOST_64_BIT bfd_signed_vma;
85typedef unsigned HOST_64_BIT bfd_size_type;
86typedef unsigned HOST_64_BIT symvalue;
9b9c5c39
JG
87#define fprintf_vma(s,x) \
88 fprintf(s,"%08x%08x", uint64_typeHIGH(x), uint64_typeLOW(x))
14e3c2e4
JK
89#else /* not HOST_64_BIT. */
90
91/* Represent a target address. Also used as a generic unsigned type
92 which is guaranteed to be big enough to hold any arithmetic types
93 we need to deal with. */
a07cc613 94typedef unsigned long bfd_vma;
14e3c2e4
JK
95
96/* A generic signed type which is guaranteed to be big enough to hold any
97 arithmetic types we need to deal with. Can be assumed to be compatible
98 with bfd_vma in the same way that signed and unsigned ints are compatible
99 (as parameters, in assignment, etc). */
100typedef long bfd_signed_vma;
101
19b03b7a
SC
102typedef unsigned long symvalue;
103typedef unsigned long bfd_size_type;
14e3c2e4
JK
104
105/* Print a bfd_vma x on stream s. */
a737c70b 106#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
14e3c2e4 107#endif /* not HOST_64_BIT. */
1d2c5574 108#define printf_vma(x) fprintf_vma(stdout,x)
a07cc613
JG
109
110typedef unsigned int flagword; /* 32 bits of flags */
111\f
112/** File formats */
113
114typedef enum bfd_format {
115 bfd_unknown = 0, /* file format is unknown */
116 bfd_object, /* linker/assember/compiler output */
117 bfd_archive, /* object archive file */
118 bfd_core, /* core dump */
119 bfd_type_end} /* marks the end; don't use it! */
120 bfd_format;
121
122/* Object file flag values */
01bbba25
SC
123#define NO_FLAGS 0x00
124#define HAS_RELOC 0x01
125#define EXEC_P 0x02
126#define HAS_LINENO 0x04
127#define HAS_DEBUG 0x08
128#define HAS_SYMS 0x10
129#define HAS_LOCALS 0x20
130#define DYNAMIC 0x40
131#define WP_TEXT 0x80
132#define D_PAGED 0x100
133#define BFD_IS_RELAXABLE 0x200
a07cc613
JG
134\f
135/* symbols and relocation */
136
137typedef unsigned long symindex;
138
139#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
140
fb3ee1c0
JG
141typedef enum bfd_symclass {
142 bfd_symclass_unknown = 0,
a07cc613
JG
143 bfd_symclass_fcommon, /* fortran common symbols */
144 bfd_symclass_global, /* global symbol, what a surprise */
145 bfd_symclass_debugger, /* some debugger symbol */
146 bfd_symclass_undefined /* none known */
147 } symclass;
148
19b03b7a 149
a07cc613 150typedef int symtype; /* Who knows, yet? */
19b03b7a 151
a07cc613 152
9b9c5c39
JG
153/* general purpose part of a symbol;
154 target specific parts will be found in libcoff.h, liba.out.h etc */
7a276b09 155
a07cc613
JG
156
157#define bfd_get_section(x) ((x)->section)
158#define bfd_get_output_section(x) ((x)->section->output_section)
159#define bfd_set_section(x,y) ((x)->section) = (y)
2f5e51f7 160#define bfd_asymbol_base(x) ((x)->section->vma)
74e81949 161#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
a07cc613 162#define bfd_asymbol_name(x) ((x)->name)
2f5e51f7
PB
163/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
164#define bfd_asymbol_bfd(x) ((x)->the_bfd)
165#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
a07cc613 166
a07cc613 167/* This is a type pun with struct ranlib on purpose! */
9c6a9c92 168typedef struct carsym {
a07cc613
JG
169 char *name;
170 file_ptr file_offset; /* look here to find the file */
171} carsym; /* to make these you call a carsymogen */
172
a07cc613
JG
173
174/* Used in generating armaps. Perhaps just a forward definition would do? */
175struct orl { /* output ranlib */
176 char **name; /* symbol name */
c93e2c55 177 file_ptr pos; /* bfd* or file position */
a07cc613
JG
178 int namidx; /* index into string table */
179};
180
181\f
182
183/* Linenumber stuff */
184typedef struct lineno_cache_entry {
185 unsigned int line_number; /* Linenumber from start of function*/
186 union {
7a276b09 187 struct symbol_cache_entry *sym; /* Function name */
a07cc613
JG
188 unsigned long offset; /* Offset into section */
189 } u;
190} alent;
191\f
192/* object and core file sections */
193
a07cc613
JG
194
195#define align_power(addr, align) \
196 ( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
197
9c6a9c92 198typedef struct sec *sec_ptr;
a07cc613 199
d5ceae78
KR
200#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
201#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
202#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
a07cc613 203#define bfd_section_name(bfd, ptr) ((ptr)->name)
9a7c5449 204#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
a07cc613
JG
205#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
206#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
d5ceae78 207#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
a07cc613
JG
208#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
209
4b9c23a9
ILT
210#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
211
ae35ae7f 212#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = true), true)
a07cc613
JG
213#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
214#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
4322f04d
SC
215
216typedef struct stat stat_type;
a07cc613
JG
217\f
218/** Error handling */
219
fb3ee1c0
JG
220typedef enum bfd_error {
221 no_error = 0, system_call_error, invalid_target,
a07cc613
JG
222 wrong_format, invalid_operation, no_memory,
223 no_symbols, no_relocation_info,
224 no_more_archived_files, malformed_archive,
225 symbol_not_found, file_not_recognized,
226 file_ambiguously_recognized, no_contents,
6603bf38 227 bfd_error_nonrepresentable_section,
d5ceae78 228 no_debug_section, bad_value,
a1ed7136
JK
229
230 /* An input file is shorter than expected. */
231 file_truncated,
232
a07cc613
JG
233 invalid_error_code} bfd_ec;
234
235extern bfd_ec bfd_error;
9a7c5449 236struct reloc_cache_entry;
f6047bbd 237struct bfd_seclet;
9a7c5449 238
a07cc613 239
9c6a9c92 240typedef struct bfd_error_vector {
d4a06831
JG
241 void (* nonrepresentable_section ) PARAMS ((CONST bfd *CONST abfd,
242 CONST char *CONST name));
243 void (* undefined_symbol) PARAMS ((CONST struct reloc_cache_entry *rel,
244 CONST struct bfd_seclet *sec));
245 void (* reloc_value_truncated) PARAMS ((CONST struct
9a7c5449 246 reloc_cache_entry *rel,
f6047bbd 247 struct bfd_seclet *sec));
9a7c5449 248
d4a06831
JG
249 void (* reloc_dangerous) PARAMS ((CONST struct reloc_cache_entry *rel,
250 CONST struct bfd_seclet *sec));
9a7c5449 251
a07cc613
JG
252} bfd_error_vector_type;
253
d4a06831
JG
254CONST char *bfd_errmsg PARAMS ((bfd_ec error_tag));
255void bfd_perror PARAMS ((CONST char *message));
a07cc613
JG
256\f
257
9b9c5c39 258typedef enum bfd_print_symbol
a07cc613 259{
81f8fee9
JG
260 bfd_print_symbol_name,
261 bfd_print_symbol_more,
b639b27b 262 bfd_print_symbol_all
81f8fee9 263} bfd_print_symbol_type;
a07cc613
JG
264
265\f
b639b27b
SC
266/* Information about a symbol that nm needs. */
267
268typedef struct _symbol_info
269{
270 symvalue value;
271 char type; /* */
272 CONST char *name; /* Symbol name. */
273 char stab_other; /* Unused. */
274 short stab_desc; /* Info for N_TYPE. */
275 CONST char *stab_name;
276} symbol_info;
a07cc613
JG
277\f
278/* The code that implements targets can initialize a jump table with this
279 macro. It must name all its routines the same way (a prefix plus
280 the standard routine suffix), or it must #define the routines that
281 are not so named, before calling JUMP_TABLE in the initializer. */
282
283/* Semi-portable string concatenation in cpp */
284#ifndef CAT
285#ifdef __STDC__
286#define CAT(a,b) a##b
287#else
288#define CAT(a,b) a/**/b
289#endif
290#endif
291
292#define JUMP_TABLE(NAME)\
293CAT(NAME,_core_file_failing_command),\
294CAT(NAME,_core_file_failing_signal),\
295CAT(NAME,_core_file_matches_executable_p),\
296CAT(NAME,_slurp_armap),\
297CAT(NAME,_slurp_extended_name_table),\
298CAT(NAME,_truncate_arname),\
299CAT(NAME,_write_armap),\
300CAT(NAME,_close_and_cleanup), \
301CAT(NAME,_set_section_contents),\
302CAT(NAME,_get_section_contents),\
303CAT(NAME,_new_section_hook),\
304CAT(NAME,_get_symtab_upper_bound),\
305CAT(NAME,_get_symtab),\
306CAT(NAME,_get_reloc_upper_bound),\
307CAT(NAME,_canonicalize_reloc),\
308CAT(NAME,_make_empty_symbol),\
309CAT(NAME,_print_symbol),\
b639b27b 310CAT(NAME,_get_symbol_info),\
a07cc613
JG
311CAT(NAME,_get_lineno),\
312CAT(NAME,_set_arch_mach),\
313CAT(NAME,_openr_next_archived_file),\
314CAT(NAME,_find_nearest_line),\
315CAT(NAME,_generic_stat_arch_elt),\
7a276b09
SC
316CAT(NAME,_sizeof_headers),\
317CAT(NAME,_bfd_debug_info_start),\
318CAT(NAME,_bfd_debug_info_end),\
9a7c5449 319CAT(NAME,_bfd_debug_info_accumulate),\
daa91756 320CAT(NAME,_bfd_get_relocated_section_contents),\
870f29f5 321CAT(NAME,_bfd_relax_section),\
cd211312
ILT
322CAT(NAME,_bfd_seclet_link),\
323CAT(NAME,_bfd_reloc_type_lookup),\
324CAT(NAME,_bfd_make_debug_symbol)
2700c3c7 325
355e5a8e 326#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
0c210c9c 327
a07cc613
JG
328\f
329/* User program access to BFD facilities */
330
331extern CONST short _bfd_host_big_endian;
332#define HOST_BYTE_ORDER_BIG_P (*(char *)&_bfd_host_big_endian)
333
334/* The bfd itself */
335
8c01a0ea
JK
336/* Cast from const char * to char * so that caller can assign to
337 a char * without a warning. */
338#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
a07cc613
JG
339#define bfd_get_format(abfd) ((abfd)->format)
340#define bfd_get_target(abfd) ((abfd)->xvec->name)
341#define bfd_get_file_flags(abfd) ((abfd)->flags)
342#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
343#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
22ef104a 344#define bfd_my_archive(abfd) ((abfd)->my_archive)
a07cc613
JG
345#define bfd_has_map(abfd) ((abfd)->has_armap)
346#define bfd_header_twiddle_required(abfd) \
347 ((((abfd)->xvec->header_byteorder_big_p) \
348 != (boolean)HOST_BYTE_ORDER_BIG_P) ? true:false)
349
350#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
351#define bfd_usrdata(abfd) ((abfd)->usrdata)
352
353#define bfd_get_start_address(abfd) ((abfd)->start_address)
354#define bfd_get_symcount(abfd) ((abfd)->symcount)
355#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
356#define bfd_count_sections(abfd) ((abfd)->section_count)
357#define bfd_get_architecture(abfd) ((abfd)->obj_arch)
358#define bfd_get_machine(abfd) ((abfd)->obj_machine)
359
ab414d87 360#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
a07cc613 361
7a276b09
SC
362#define BYTE_SIZE 1
363#define SHORT_SIZE 2
364#define LONG_SIZE 4
365
d5ceae78 366/* And more from the source. */
18fe0e9f
JG
367void
368bfd_init PARAMS ((void));
369
370bfd *
371bfd_openr PARAMS ((CONST char *filename, CONST char*target));
372
373bfd *
374bfd_fdopenr PARAMS ((CONST char *filename, CONST char *target, int fd));
375
376bfd *
377bfd_openw PARAMS ((CONST char *filename, CONST char *target));
378
379boolean
380bfd_close PARAMS ((bfd *));
381
382boolean
383bfd_close_all_done PARAMS ((bfd *));
384
385bfd_size_type
386bfd_alloc_size PARAMS ((bfd *abfd));
387
388bfd *
389bfd_create PARAMS ((CONST char *filename, bfd *template));
390
236e2916
JG
391
392 /* Byte swapping macros for user section data. */
393
7a276b09 394#define bfd_put_8(abfd, val, ptr) \
236e2916
JG
395 (*((unsigned char *)(ptr)) = (unsigned char)val)
396#define bfd_put_signed_8 \
397 bfd_put_8
7a276b09 398#define bfd_get_8(abfd, ptr) \
236e2916
JG
399 (*(unsigned char *)(ptr))
400#define bfd_get_signed_8(abfd, ptr) \
401 ((*(unsigned char *)(ptr) ^ 0x80) - 0x80)
402
7a276b09 403#define bfd_put_16(abfd, val, ptr) \
882885d3 404 BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
236e2916
JG
405#define bfd_put_signed_16 \
406 bfd_put_16
7a276b09
SC
407#define bfd_get_16(abfd, ptr) \
408 BFD_SEND(abfd, bfd_getx16, (ptr))
14e3c2e4
JK
409#define bfd_get_signed_16(abfd, ptr) \
410 BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
236e2916 411
7a276b09 412#define bfd_put_32(abfd, val, ptr) \
882885d3 413 BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
236e2916
JG
414#define bfd_put_signed_32 \
415 bfd_put_32
7a276b09
SC
416#define bfd_get_32(abfd, ptr) \
417 BFD_SEND(abfd, bfd_getx32, (ptr))
14e3c2e4
JK
418#define bfd_get_signed_32(abfd, ptr) \
419 BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
236e2916 420
7a276b09 421#define bfd_put_64(abfd, val, ptr) \
882885d3 422 BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
236e2916
JG
423#define bfd_put_signed_64 \
424 bfd_put_64
7a276b09
SC
425#define bfd_get_64(abfd, ptr) \
426 BFD_SEND(abfd, bfd_getx64, (ptr))
14e3c2e4
JK
427#define bfd_get_signed_64(abfd, ptr) \
428 BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
236e2916
JG
429
430
431 /* Byte swapping macros for file header data. */
432
7a276b09 433#define bfd_h_put_8(abfd, val, ptr) \
236e2916
JG
434 bfd_put_8 (abfd, val, ptr)
435#define bfd_h_put_signed_8(abfd, val, ptr) \
436 bfd_put_8 (abfd, val, ptr)
7a276b09 437#define bfd_h_get_8(abfd, ptr) \
236e2916
JG
438 bfd_get_8 (abfd, ptr)
439#define bfd_h_get_signed_8(abfd, ptr) \
440 bfd_get_signed_8 (abfd, ptr)
441
7a276b09
SC
442#define bfd_h_put_16(abfd, val, ptr) \
443 BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
236e2916
JG
444#define bfd_h_put_signed_16 \
445 bfd_h_put_16
7a276b09
SC
446#define bfd_h_get_16(abfd, ptr) \
447 BFD_SEND(abfd, bfd_h_getx16,(ptr))
14e3c2e4
JK
448#define bfd_h_get_signed_16(abfd, ptr) \
449 BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr))
236e2916 450
7a276b09
SC
451#define bfd_h_put_32(abfd, val, ptr) \
452 BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
236e2916
JG
453#define bfd_h_put_signed_32 \
454 bfd_h_put_32
7a276b09
SC
455#define bfd_h_get_32(abfd, ptr) \
456 BFD_SEND(abfd, bfd_h_getx32,(ptr))
14e3c2e4
JK
457#define bfd_h_get_signed_32(abfd, ptr) \
458 BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr))
236e2916 459
7a276b09
SC
460#define bfd_h_put_64(abfd, val, ptr) \
461 BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
236e2916
JG
462#define bfd_h_put_signed_64 \
463 bfd_h_put_64
7a276b09
SC
464#define bfd_h_get_64(abfd, ptr) \
465 BFD_SEND(abfd, bfd_h_getx64,(ptr))
14e3c2e4
JK
466#define bfd_h_get_signed_64(abfd, ptr) \
467 BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
236e2916 468
332b6327
SC
469typedef struct sec
470{
471 /* The name of the section, the name isn't a copy, the pointer is
472 the same as that passed to bfd_make_section. */
473
7a276b09 474 CONST char *name;
332b6327 475
9a7c5449
SC
476
477 /* Which section is it 0.nth */
478
479 int index;
480
332b6327
SC
481 /* The next section in the list belonging to the BFD, or NULL. */
482
7a276b09 483 struct sec *next;
332b6327
SC
484
485 /* The field flags contains attributes of the section. Some of
486 flags are read in from the object file, and some are
487 synthesized from other information. */
488
6d56c69a 489 flagword flags;
332b6327 490
7a276b09 491#define SEC_NO_FLAGS 0x000
332b6327
SC
492
493 /* Tells the OS to allocate space for this section when loaded.
494 This would clear for a section containing debug information
495 only. */
496
497
7a276b09 498#define SEC_ALLOC 0x001
332b6327
SC
499 /* Tells the OS to load the section from the file when loading.
500 This would be clear for a .bss section */
501
7a276b09 502#define SEC_LOAD 0x002
332b6327
SC
503 /* The section contains data still to be relocated, so there will
504 be some relocation information too. */
505
7a276b09 506#define SEC_RELOC 0x004
332b6327
SC
507
508 /* Obsolete ? */
509
7a276b09 510#define SEC_BALIGN 0x008
332b6327
SC
511
512 /* A signal to the OS that the section contains read only
513 data. */
7a276b09 514#define SEC_READONLY 0x010
332b6327
SC
515
516 /* The section contains code only. */
517
7a276b09 518#define SEC_CODE 0x020
332b6327
SC
519
520 /* The section contains data only. */
521
7a276b09 522#define SEC_DATA 0x040
332b6327
SC
523
524 /* The section will reside in ROM. */
525
7a276b09 526#define SEC_ROM 0x080
332b6327
SC
527
528 /* The section contains constructor information. This section
529 type is used by the linker to create lists of constructors and
530 destructors used by <<g++>>. When a back end sees a symbol
531 which should be used in a constructor list, it creates a new
532 section for the type of name (eg <<__CTOR_LIST__>>), attaches
533 the symbol to it and builds a relocation. To build the lists
534 of constructors, all the linker has to to is catenate all the
535 sections called <<__CTOR_LIST__>> and relocte the data
536 contained within - exactly the operations it would peform on
537 standard data. */
538
7a276b09 539#define SEC_CONSTRUCTOR 0x100
332b6327
SC
540
541 /* The section is a constuctor, and should be placed at the
542 end of the . */
543
1c6c6598 544#define SEC_CONSTRUCTOR_TEXT 0x1100
332b6327 545
1c6c6598 546#define SEC_CONSTRUCTOR_DATA 0x2100
332b6327 547
1c6c6598 548#define SEC_CONSTRUCTOR_BSS 0x3100
332b6327 549
4b9c23a9 550 /* The section has contents - a data section could be
332b6327
SC
551 <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>, a debug section could be
552 <<SEC_HAS_CONTENTS>> */
553
7a276b09 554#define SEC_HAS_CONTENTS 0x200
332b6327
SC
555
556 /* An instruction to the linker not to output sections
557 containing this flag even if they have information which
558 would normally be written. */
559
7a276b09 560#define SEC_NEVER_LOAD 0x400
332b6327 561
41d1b02f
ILT
562 /* The section is a shared library section. The linker must leave
563 these completely alone, as the vma and size are used when
564 the executable is loaded. */
565
566#define SEC_SHARED_LIBRARY 0x800
9a7c5449 567
4b9c23a9
ILT
568 /* The section is a common section (symbols may be defined
569 multiple times, the value of a symbol is the amount of
570 space it requires, and the largest symbol value is the one
571 used). Most targets have exactly one of these (.bss), but
572 ECOFF has two. */
573
574#define SEC_IS_COMMON 0x8000
ae35ae7f
SC
575
576 /* The virtual memory address of the section - where it will be
577 at run time - the symbols are relocated against this */
7a276b09 578 bfd_vma vma;
ae35ae7f
SC
579
580 /* The load address of the section - where it would be in a
581 rom image, really only used for writing section header information */
582 bfd_vma lma;
583
9a51287f 584 boolean user_set_vma;
332b6327 585
9a7c5449 586 /* The size of the section in bytes, as it will be output.
332b6327 587 contains a value even if the section has no contents (eg, the
9a7c5449 588 size of <<.bss>>). This will be filled in after relocation */
332b6327 589
9a7c5449
SC
590 bfd_size_type _cooked_size;
591
592 /* The size on disk of the section in bytes originally. Normally this
593 value is the same as the size, but if some relaxing has
594 been done, then this value will be bigger. */
595
596 bfd_size_type _raw_size;
332b6327
SC
597
598 /* If this section is going to be output, then this value is the
599 offset into the output section of the first byte in the input
600 section. Eg, if this was going to start at the 100th byte in
601 the output section, this value would be 100. */
602
7a276b09 603 bfd_vma output_offset;
332b6327
SC
604
605 /* The output section through which to map on output. */
606
7a276b09 607 struct sec *output_section;
332b6327
SC
608
609 /* The alignment requirement of the section, as an exponent - eg
610 3 aligns to 2^3 (or 8) */
611
7a276b09 612 unsigned int alignment_power;
332b6327
SC
613
614 /* If an input section, a pointer to a vector of relocation
615 records for the data in this section. */
616
7a276b09 617 struct reloc_cache_entry *relocation;
332b6327
SC
618
619 /* If an output section, a pointer to a vector of pointers to
620 relocation records for the data in this section. */
621
7a276b09 622 struct reloc_cache_entry **orelocation;
332b6327
SC
623
624 /* The number of relocation records in one of the above */
625
7a276b09 626 unsigned reloc_count;
332b6327 627
332b6327
SC
628 /* Information below is back end specific - and not always used
629 or updated
630
631 File position of section data */
632
7a276b09 633 file_ptr filepos;
332b6327
SC
634
635 /* File position of relocation info */
636
7a276b09 637 file_ptr rel_filepos;
332b6327
SC
638
639 /* File position of line data */
640
7a276b09 641 file_ptr line_filepos;
332b6327
SC
642
643 /* Pointer to data for applications */
644
7a276b09 645 PTR userdata;
332b6327 646
7a276b09 647 struct lang_output_section *otheruserdata;
332b6327
SC
648
649 /* Attached line number information */
650
7a276b09 651 alent *lineno;
332b6327
SC
652
653 /* Number of line number records */
654
7a276b09 655 unsigned int lineno_count;
332b6327
SC
656
657 /* When a section is being output, this value changes as more
658 linenumbers are written out */
659
7a276b09 660 file_ptr moving_line_filepos;
332b6327
SC
661
662 /* what the section number is in the target world */
663
9a7c5449 664 int target_index;
332b6327 665
7a276b09 666 PTR used_by_bfd;
332b6327
SC
667
668 /* If this is a constructor section then here is a list of the
669 relocations created to relocate items within it. */
670
7a276b09 671 struct relent_chain *constructor_chain;
332b6327
SC
672
673 /* The BFD which owns the section. */
674
7a276b09 675 bfd *owner;
332b6327 676
9a7c5449
SC
677 boolean reloc_done;
678 /* A symbol which points at this section only */
679 struct symbol_cache_entry *symbol;
680 struct symbol_cache_entry **symbol_ptr_ptr;
f6047bbd
JG
681 struct bfd_seclet *seclets_head;
682 struct bfd_seclet *seclets_tail;
7a276b09 683} asection ;
9a7c5449
SC
684
685
686#define BFD_ABS_SECTION_NAME "*ABS*"
687#define BFD_UND_SECTION_NAME "*UND*"
688#define BFD_COM_SECTION_NAME "*COM*"
af6d4cf5 689#define BFD_IND_SECTION_NAME "*IND*"
9a7c5449
SC
690
691 /* the absolute section */
692 extern asection bfd_abs_section;
693 /* Pointer to the undefined section */
694 extern asection bfd_und_section;
695 /* Pointer to the common section */
696 extern asection bfd_com_section;
af6d4cf5
SC
697 /* Pointer to the indirect section */
698 extern asection bfd_ind_section;
9a7c5449
SC
699
700 extern struct symbol_cache_entry *bfd_abs_symbol;
701 extern struct symbol_cache_entry *bfd_com_symbol;
702 extern struct symbol_cache_entry *bfd_und_symbol;
af6d4cf5 703 extern struct symbol_cache_entry *bfd_ind_symbol;
9a7c5449
SC
704#define bfd_get_section_size_before_reloc(section) \
705 (section->reloc_done ? (abort(),1): (section)->_raw_size)
706#define bfd_get_section_size_after_reloc(section) \
707 ((section->reloc_done) ? (section)->_cooked_size: (abort(),1))
18fe0e9f
JG
708asection *
709bfd_get_section_by_name PARAMS ((bfd *abfd, CONST char *name));
710
711asection *
712bfd_make_section_old_way PARAMS ((bfd *, CONST char *name));
713
714asection *
715bfd_make_section PARAMS ((bfd *, CONST char *name));
716
717boolean
718bfd_set_section_flags PARAMS ((bfd *, asection *, flagword));
719
720void
721bfd_map_over_sections PARAMS ((bfd *abfd,
f48e5efe
JG
722 void (*func)(bfd *abfd,
723 asection *sect,
724 PTR obj),
725 PTR obj));
18fe0e9f
JG
726
727boolean
728bfd_set_section_size PARAMS ((bfd *, asection *, bfd_size_type val));
729
730boolean
731bfd_set_section_contents
732 PARAMS ((bfd *abfd,
332b6327
SC
733 asection *section,
734 PTR data,
735 file_ptr offset,
736 bfd_size_type count));
18fe0e9f
JG
737
738boolean
739bfd_get_section_contents
740 PARAMS ((bfd *abfd, asection *section, PTR location,
332b6327 741 file_ptr offset, bfd_size_type count));
18fe0e9f 742
b39096a4 743enum bfd_architecture
7a276b09 744{
6d56c69a
SC
745 bfd_arch_unknown, /* File arch not known */
746 bfd_arch_obscure, /* Arch known, not one of these */
747 bfd_arch_m68k, /* Motorola 68xxx */
748 bfd_arch_vax, /* DEC Vax */
749 bfd_arch_i960, /* Intel 960 */
750 /* The order of the following is important.
b39096a4
SC
751 lower number indicates a machine type that
752 only accepts a subset of the instructions
753 available to machines with higher numbers.
754 The exception is the "ca", which is
755 incompatible with all other machines except
756 "core". */
7a276b09 757
b39096a4
SC
758#define bfd_mach_i960_core 1
759#define bfd_mach_i960_ka_sa 2
760#define bfd_mach_i960_kb_sb 3
761#define bfd_mach_i960_mc 4
762#define bfd_mach_i960_xa 5
763#define bfd_mach_i960_ca 6
764
6d56c69a
SC
765 bfd_arch_a29k, /* AMD 29000 */
766 bfd_arch_sparc, /* SPARC */
767 bfd_arch_mips, /* MIPS Rxxxx */
768 bfd_arch_i386, /* Intel 386 */
60289922 769 bfd_arch_we32k, /* AT&T WE32xxx */
6d56c69a
SC
770 bfd_arch_tahoe, /* CCI/Harris Tahoe */
771 bfd_arch_i860, /* Intel 860 */
772 bfd_arch_romp, /* IBM ROMP PC/RT */
773 bfd_arch_alliant, /* Alliant */
774 bfd_arch_convex, /* Convex */
775 bfd_arch_m88k, /* Motorola 88xxx */
776 bfd_arch_pyramid, /* Pyramid Technology */
777 bfd_arch_h8300, /* Hitachi H8/300 */
778 bfd_arch_rs6000, /* IBM RS/6000 */
5e511f6f 779 bfd_arch_hppa, /* HP PA RISC */
3ab9faab
SC
780 bfd_arch_z8k, /* Zilog Z8000 */
781#define bfd_mach_z8001 1
782#define bfd_mach_z8002 2
4e72fdc0 783 bfd_arch_h8500, /* Hitachi H8/500 */
ed173a76 784 bfd_arch_sh, /* Hitachi SH */
5f8f6d56 785 bfd_arch_alpha, /* Dec Alpha */
b39096a4
SC
786 bfd_arch_last
787 };
bded7de2 788
81f8fee9 789typedef struct bfd_arch_info
b39096a4
SC
790{
791 int bits_per_word;
792 int bits_per_address;
793 int bits_per_byte;
794 enum bfd_architecture arch;
795 long mach;
796 char *arch_name;
797 CONST char *printable_name;
9a51287f 798 unsigned int section_align_power;
43857158 799 /* true if this is the default machine for the architecture */
b39096a4 800 boolean the_default;
18fe0e9f
JG
801 CONST struct bfd_arch_info * (*compatible)
802 PARAMS ((CONST struct bfd_arch_info *a,
803 CONST struct bfd_arch_info *b));
b39096a4 804
18fe0e9f 805 boolean (*scan) PARAMS ((CONST struct bfd_arch_info *, CONST char *));
355e5a8e
KR
806 /* How to disassemble an instruction, producing a printable
807 representation on a specified stdio stream. This isn't
808 defined for most processors at present, because of the size
809 of the additional tables it would drag in, and because gdb
810 wants to use a different interface. */
18fe0e9f
JG
811 unsigned int (*disassemble) PARAMS ((bfd_vma addr, CONST char *data,
812 PTR stream));
b39096a4 813
9a51287f 814 struct bfd_arch_info *next;
81f8fee9 815} bfd_arch_info_type;
18fe0e9f
JG
816CONST char *
817bfd_printable_name PARAMS ((bfd *abfd));
818
819bfd_arch_info_type *
820bfd_scan_arch PARAMS ((CONST char *));
821
822CONST bfd_arch_info_type *
823bfd_arch_get_compatible PARAMS ((
332b6327
SC
824 CONST bfd *abfd,
825 CONST bfd *bbfd));
18fe0e9f
JG
826
827void
828bfd_set_arch_info PARAMS ((bfd *, bfd_arch_info_type *));
829
830enum bfd_architecture
831bfd_get_arch PARAMS ((bfd *abfd));
832
833unsigned long
834bfd_get_mach PARAMS ((bfd *abfd));
835
836unsigned int
837bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
838
839unsigned int
840bfd_arch_bits_per_address PARAMS ((bfd *abfd));
841
842bfd_arch_info_type *
843bfd_get_arch_info PARAMS ((bfd *));
844
845bfd_arch_info_type *
846bfd_lookup_arch
847 PARAMS ((enum bfd_architecture
332b6327
SC
848 arch,
849 long machine));
18fe0e9f
JG
850
851CONST char *
852bfd_printable_arch_mach
853 PARAMS ((enum bfd_architecture arch, unsigned long machine));
854
332b6327
SC
855typedef enum bfd_reloc_status
856{
857 /* No errors detected */
b39096a4 858 bfd_reloc_ok,
332b6327
SC
859
860 /* The relocation was performed, but there was an overflow. */
b39096a4 861 bfd_reloc_overflow,
332b6327 862
14e3c2e4 863 /* The address to relocate was not within the section supplied. */
b39096a4 864 bfd_reloc_outofrange,
332b6327
SC
865
866 /* Used by special functions */
b39096a4 867 bfd_reloc_continue,
332b6327
SC
868
869 /* Unused */
b39096a4 870 bfd_reloc_notsupported,
332b6327 871
14e3c2e4 872 /* Unsupported relocation size requested. */
b39096a4 873 bfd_reloc_other,
332b6327 874
14e3c2e4 875 /* The symbol to relocate against was undefined. */
b39096a4 876 bfd_reloc_undefined,
332b6327
SC
877
878 /* The relocation was performed, but may not be ok - presently
879 generated only when linking i960 coff files with i960 b.out
880 symbols. */
b39096a4 881 bfd_reloc_dangerous
332b6327 882 }
81f8fee9 883 bfd_reloc_status_type;
332b6327
SC
884
885
b39096a4
SC
886typedef struct reloc_cache_entry
887{
332b6327 888 /* A pointer into the canonical table of pointers */
b39096a4 889 struct symbol_cache_entry **sym_ptr_ptr;
332b6327
SC
890
891 /* offset in section */
14e3c2e4 892 bfd_size_type address;
332b6327
SC
893
894 /* addend for relocation value */
b39096a4 895 bfd_vma addend;
332b6327 896
332b6327 897 /* Pointer to how to perform the required relocation */
b39096a4 898 CONST struct reloc_howto_struct *howto;
332b6327 899
b39096a4 900} arelent;
f48e5efe 901
b39096a4
SC
902typedef CONST struct reloc_howto_struct
903{
332b6327
SC
904 /* The type field has mainly a documetary use - the back end can
905 to what it wants with it, though the normally the back end's
906 external idea of what a reloc number would be would be stored
907 in this field. For example, the a PC relative word relocation
908 in a coff environment would have the type 023 - because that's
909 what the outside world calls a R_PCRWORD reloc. */
b39096a4 910 unsigned int type;
332b6327
SC
911
912 /* The value the final relocation is shifted right by. This drops
913 unwanted data from the relocation. */
b39096a4 914 unsigned int rightshift;
332b6327
SC
915
916 /* The size of the item to be relocated - 0, is one byte, 1 is 2
aae98307 917 bytes, 2 is four bytes. A negative value indicates that the
7917455f 918 result is to be subtracted from the data. */
2c0e53a4 919 int size;
332b6327 920
7917455f 921 /* Now obsolete? But m68k-coff still uses it... */
b39096a4 922 unsigned int bitsize;
332b6327
SC
923
924 /* Notes that the relocation is relative to the location in the
925 data section of the addend. The relocation function will
926 subtract from the relocation value the address of the location
927 being relocated. */
b39096a4 928 boolean pc_relative;
332b6327 929
b39096a4 930 unsigned int bitpos;
332b6327
SC
931
932 /* Now obsolete */
b39096a4 933 boolean absolute;
332b6327
SC
934
935 /* Causes the relocation routine to return an error if overflow
936 is detected when relocating. */
b39096a4 937 boolean complain_on_overflow;
332b6327
SC
938
939 /* If this field is non null, then the supplied function is
940 called rather than the normal function. This allows really
7917455f 941 strange relocation methods to be accomodated (e.g., i960 callj
332b6327 942 instructions). */
18fe0e9f
JG
943 bfd_reloc_status_type (*special_function)
944 PARAMS ((bfd *abfd,
f48e5efe
JG
945 arelent *reloc_entry,
946 struct symbol_cache_entry *symbol,
947 PTR data,
2d690b0a 948 asection *input_section,
18fe0e9f 949 bfd *output_bfd));
332b6327
SC
950
951 /* The textual name of the relocation type. */
b39096a4 952 char *name;
332b6327
SC
953
954 /* When performing a partial link, some formats must modify the
955 relocations rather than the data - this flag signals this.*/
b39096a4 956 boolean partial_inplace;
332b6327
SC
957
958 /* The src_mask is used to select what parts of the read in data
7917455f 959 are to be used in the relocation sum. E.g., if this was an 8 bit
332b6327
SC
960 bit of data which we read and relocated, this would be
961 0x000000ff. When we have relocs which have an addend, such as
962 sun4 extended relocs, the value in the offset part of a
963 relocating field is garbage so we never use it. In this case
964 the mask would be 0x00000000. */
14e3c2e4 965 bfd_vma src_mask;
332b6327
SC
966
967 /* The dst_mask is what parts of the instruction are replaced
968 into the instruction. In most cases src_mask == dst_mask,
969 except in the above special case, where dst_mask would be
970 0x000000ff, and src_mask would be 0x00000000. */
14e3c2e4 971 bfd_vma dst_mask;
332b6327
SC
972
973 /* When some formats create PC relative instructions, they leave
974 the value of the pc of the place being relocated in the offset
975 slot of the instruction, so that a PC relative relocation can
7917455f 976 be made just by adding in an ordinary offset (e.g., sun3 a.out).
332b6327 977 Some formats leave the displacement part of an instruction
7917455f 978 empty (e.g., m88k bcs), this flag signals the fact.*/
b39096a4 979 boolean pcrel_offset;
332b6327 980
b39096a4 981} reloc_howto_type;
b39096a4
SC
982#define HOWTO(C, R,S,B, P, BI, ABS, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
983 {(unsigned)C,R,S,B, P, BI, ABS,O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
46773090 984#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,false,false,FUNCTION, NAME,false,0,0,IN)
7a276b09 985
332b6327
SC
986#define HOWTO_PREPARE(relocation, symbol) \
987 { \
988 if (symbol != (asymbol *)NULL) { \
4b9c23a9 989 if (bfd_is_com_section (symbol->section)) { \
332b6327
SC
990 relocation = 0; \
991 } \
992 else { \
993 relocation = symbol->value; \
994 } \
995 } \
332b6327 996}
b39096a4 997typedef unsigned char bfd_byte;
bded7de2 998
b39096a4
SC
999typedef struct relent_chain {
1000 arelent relent;
1001 struct relent_chain *next;
1002} arelent_chain;
6d56c69a 1003bfd_reloc_status_type
18fe0e9f
JG
1004
1005bfd_perform_relocation
1006 PARAMS ((bfd * abfd,
332b6327
SC
1007 arelent *reloc_entry,
1008 PTR data,
1009 asection *input_section,
1010 bfd *output_bfd));
18fe0e9f 1011
332b6327 1012typedef enum bfd_reloc_code_real
3ab9faab 1013
332b6327
SC
1014{
1015 /* 16 bits wide, simple reloc */
1016 BFD_RELOC_16,
1017
1018 /* 8 bits wide, but used to form an address like 0xffnn */
de7e640d 1019 BFD_RELOC_8_FFnn,
332b6327
SC
1020
1021 /* 8 bits wide, simple */
de7e640d 1022 BFD_RELOC_8,
332b6327
SC
1023
1024 /* 8 bits wide, pc relative */
358c1d4d 1025 BFD_RELOC_8_PCREL,
332b6327
SC
1026
1027 /* The type of reloc used to build a contructor table - at the
1028 moment probably a 32 bit wide abs address, but the cpu can
1029 choose. */
1030
d5ceae78
KR
1031 BFD_RELOC_CTOR,
1032
1033 /* 32 bits wide, simple reloc */
1034 BFD_RELOC_32,
1035 /* 32 bits, PC-relative */
1036 BFD_RELOC_32_PCREL,
1037
1038 /* High 22 bits of 32-bit value; simple reloc. */
1039 BFD_RELOC_HI22,
1040 /* Low 10 bits. */
1041 BFD_RELOC_LO10,
1042
1043 /* Reloc types used for i960/b.out. */
1044 BFD_RELOC_24_PCREL,
1045 BFD_RELOC_I960_CALLJ,
1046
1047 BFD_RELOC_16_PCREL,
1048 /* 32-bit pc-relative, shifted right 2 bits (i.e., 30-bit
1049 word displacement, e.g. for SPARC) */
1050 BFD_RELOC_32_PCREL_S2,
1051
1052 /* now for the sparc/elf codes */
1053 BFD_RELOC_NONE, /* actually used */
1054 BFD_RELOC_SPARC_WDISP22,
1055 BFD_RELOC_SPARC22,
1056 BFD_RELOC_SPARC13,
1057 BFD_RELOC_SPARC_BASE13,
1058 BFD_RELOC_SPARC_GOT10,
1059 BFD_RELOC_SPARC_GOT13,
1060 BFD_RELOC_SPARC_GOT22,
1061 BFD_RELOC_SPARC_PC10,
1062 BFD_RELOC_SPARC_PC22,
1063 BFD_RELOC_SPARC_WPLT30,
1064 BFD_RELOC_SPARC_COPY,
1065 BFD_RELOC_SPARC_GLOB_DAT,
1066 BFD_RELOC_SPARC_JMP_SLOT,
1067 BFD_RELOC_SPARC_RELATIVE,
1068 BFD_RELOC_SPARC_UA32,
1069
1070 /* this one is a.out specific? */
1071 BFD_RELOC_SPARC_BASE22,
1072
aae98307
KR
1073 /* Bits 27..2 of the relocation address shifted right 2 bits;
1074 simple reloc otherwise. */
1075 BFD_RELOC_MIPS_JMP,
1076
1077 /* signed 16-bit pc-relative, shifted right 2 bits (e.g. for MIPS) */
1078 BFD_RELOC_16_PCREL_S2,
1079
1080 /* High 16 bits of 32-bit value; simple reloc. */
1081 BFD_RELOC_HI16,
1082 /* High 16 bits of 32-bit value but the low 16 bits will be sign
1083 extended and added to form the final result. If the low 16
1084 bits form a negative number, we need to add one to the high value
1085 to compensate for the borrow when the low bits are added. */
1086 BFD_RELOC_HI16_S,
1087 /* Low 16 bits. */
1088 BFD_RELOC_LO16,
1089
285a08ad
ILT
1090 /* 16 bit relocation relative to the global pointer. */
1091 BFD_RELOC_MIPS_GPREL,
1092
89d42788
KR
1093 /* These are, so far, specific to HPPA processors. I'm not sure that
1094 some don't duplicate other reloc types, such as BFD_RELOC_32 and
1095 _32_PCREL. Also, many more were in the list I got that don't
1096 fit in well in the model BFD uses, so I've omitted them for now.
1097 If we do make this reloc type get used for code that really does
1098 implement the funky reloc types, they'll have to be added to this
1099 list. */
1100 BFD_RELOC_HPPA_32,
1101 BFD_RELOC_HPPA_11,
1102 BFD_RELOC_HPPA_14,
1103 BFD_RELOC_HPPA_17,
1104 BFD_RELOC_HPPA_L21,
1105 BFD_RELOC_HPPA_R11,
1106 BFD_RELOC_HPPA_R14,
1107 BFD_RELOC_HPPA_R17,
1108 BFD_RELOC_HPPA_LS21,
1109 BFD_RELOC_HPPA_RS11,
1110 BFD_RELOC_HPPA_RS14,
1111 BFD_RELOC_HPPA_RS17,
1112 BFD_RELOC_HPPA_LD21,
1113 BFD_RELOC_HPPA_RD11,
1114 BFD_RELOC_HPPA_RD14,
1115 BFD_RELOC_HPPA_RD17,
1116 BFD_RELOC_HPPA_LR21,
1117 BFD_RELOC_HPPA_RR14,
1118 BFD_RELOC_HPPA_RR17,
1119 BFD_RELOC_HPPA_GOTOFF_11,
1120 BFD_RELOC_HPPA_GOTOFF_14,
1121 BFD_RELOC_HPPA_GOTOFF_L21,
1122 BFD_RELOC_HPPA_GOTOFF_R11,
1123 BFD_RELOC_HPPA_GOTOFF_R14,
1124 BFD_RELOC_HPPA_GOTOFF_LS21,
1125 BFD_RELOC_HPPA_GOTOFF_RS11,
1126 BFD_RELOC_HPPA_GOTOFF_RS14,
1127 BFD_RELOC_HPPA_GOTOFF_LD21,
1128 BFD_RELOC_HPPA_GOTOFF_RD11,
1129 BFD_RELOC_HPPA_GOTOFF_RD14,
1130 BFD_RELOC_HPPA_GOTOFF_LR21,
1131 BFD_RELOC_HPPA_GOTOFF_RR14,
1132 BFD_RELOC_HPPA_DLT_32,
1133 BFD_RELOC_HPPA_DLT_11,
1134 BFD_RELOC_HPPA_DLT_14,
1135 BFD_RELOC_HPPA_DLT_L21,
1136 BFD_RELOC_HPPA_DLT_R11,
1137 BFD_RELOC_HPPA_DLT_R14,
1138 BFD_RELOC_HPPA_ABS_CALL_11,
1139 BFD_RELOC_HPPA_ABS_CALL_14,
1140 BFD_RELOC_HPPA_ABS_CALL_17,
1141 BFD_RELOC_HPPA_ABS_CALL_L21,
1142 BFD_RELOC_HPPA_ABS_CALL_R11,
1143 BFD_RELOC_HPPA_ABS_CALL_R14,
1144 BFD_RELOC_HPPA_ABS_CALL_R17,
1145 BFD_RELOC_HPPA_ABS_CALL_LS21,
1146 BFD_RELOC_HPPA_ABS_CALL_RS11,
1147 BFD_RELOC_HPPA_ABS_CALL_RS14,
1148 BFD_RELOC_HPPA_ABS_CALL_RS17,
1149 BFD_RELOC_HPPA_ABS_CALL_LD21,
1150 BFD_RELOC_HPPA_ABS_CALL_RD11,
1151 BFD_RELOC_HPPA_ABS_CALL_RD14,
1152 BFD_RELOC_HPPA_ABS_CALL_RD17,
1153 BFD_RELOC_HPPA_ABS_CALL_LR21,
1154 BFD_RELOC_HPPA_ABS_CALL_RR14,
1155 BFD_RELOC_HPPA_ABS_CALL_RR17,
1156 BFD_RELOC_HPPA_PCREL_CALL_11,
1157 BFD_RELOC_HPPA_PCREL_CALL_14,
1158 BFD_RELOC_HPPA_PCREL_CALL_17,
1159 BFD_RELOC_HPPA_PCREL_CALL_L21,
1160 BFD_RELOC_HPPA_PCREL_CALL_R11,
1161 BFD_RELOC_HPPA_PCREL_CALL_R14,
1162 BFD_RELOC_HPPA_PCREL_CALL_R17,
1163 BFD_RELOC_HPPA_PCREL_CALL_LS21,
1164 BFD_RELOC_HPPA_PCREL_CALL_RS11,
1165 BFD_RELOC_HPPA_PCREL_CALL_RS14,
1166 BFD_RELOC_HPPA_PCREL_CALL_RS17,
1167 BFD_RELOC_HPPA_PCREL_CALL_LD21,
1168 BFD_RELOC_HPPA_PCREL_CALL_RD11,
1169 BFD_RELOC_HPPA_PCREL_CALL_RD14,
1170 BFD_RELOC_HPPA_PCREL_CALL_RD17,
1171 BFD_RELOC_HPPA_PCREL_CALL_LR21,
1172 BFD_RELOC_HPPA_PCREL_CALL_RR14,
1173 BFD_RELOC_HPPA_PCREL_CALL_RR17,
1174 BFD_RELOC_HPPA_PLABEL_32,
1175 BFD_RELOC_HPPA_PLABEL_11,
1176 BFD_RELOC_HPPA_PLABEL_14,
1177 BFD_RELOC_HPPA_PLABEL_L21,
1178 BFD_RELOC_HPPA_PLABEL_R11,
1179 BFD_RELOC_HPPA_PLABEL_R14,
1180 BFD_RELOC_HPPA_UNWIND_ENTRY,
1181 BFD_RELOC_HPPA_UNWIND_ENTRIES,
1182
d5ceae78
KR
1183 /* this must be the highest numeric value */
1184 BFD_RELOC_UNUSED
81f8fee9 1185 } bfd_reloc_code_real_type;
6d56c69a 1186CONST struct reloc_howto_struct *
18fe0e9f
JG
1187
1188bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
1189
b39096a4
SC
1190typedef struct symbol_cache_entry
1191{
332b6327
SC
1192 /* A pointer to the BFD which owns the symbol. This information
1193 is necessary so that a back end can work out what additional
355e5a8e 1194 information (invisible to the application writer) is carried
2f5e51f7 1195 with the symbol.
332b6327 1196
2f5e51f7
PB
1197 This field is *almost* redundant, since you can use section->owner
1198 instead, except that some symbols point to the global sections
1199 bfd_{abs,com,und}_section. This could be fixed by making
1200 these globals be per-bfd (or per-target-flavor). FIXME. */
1201
1202 struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
332b6327
SC
1203
1204 /* The text of the symbol. The name is left alone, and not copied - the
1205 application may not alter it. */
1206 CONST char *name;
1207
1208 /* The value of the symbol.*/
1209 symvalue value;
1210
1211 /* Attributes of a symbol: */
1212
b39096a4 1213#define BSF_NO_FLAGS 0x00
332b6327
SC
1214
1215 /* The symbol has local scope; <<static>> in <<C>>. The value
1216 is the offset into the section of the data. */
b39096a4 1217#define BSF_LOCAL 0x01
332b6327
SC
1218
1219 /* The symbol has global scope; initialized data in <<C>>. The
1220 value is the offset into the section of the data. */
b39096a4 1221#define BSF_GLOBAL 0x02
332b6327 1222
355e5a8e 1223 /* Obsolete; should be deleted? */
b39096a4 1224#define BSF_IMPORT 0x04
332b6327
SC
1225
1226 /* The symbol has global scope, and is exported. The value is
1227 the offset into the section of the data. */
b39096a4 1228#define BSF_EXPORT 0x08
332b6327
SC
1229
1230 /* The symbol is undefined. <<extern>> in <<C>>. The value has
355e5a8e 1231 no meaning. Obsolete; should be deleted? */
9a7c5449 1232#define BSF_UNDEFINED_OBS 0x10
332b6327
SC
1233
1234 /* The symbol is common, initialized to zero; default in
1235 <<C>>. The value is the size of the object in bytes. */
9a7c5449 1236#define BSF_FORT_COMM_OBS 0x20
332b6327
SC
1237
1238 /* A normal C symbol would be one of:
1239 <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
1240 <<BSF_EXPORT|BSD_GLOBAL>> */
1241
1242 /* The symbol is a debugging record. The value has an arbitary
1243 meaning. */
b39096a4 1244#define BSF_DEBUGGING 0x40
332b6327 1245
590ec838
KR
1246 /* The symbol denotes a function entry point. Used in ELF,
1247 perhaps others someday. */
1248#define BSF_FUNCTION 0x080
1249
2f5e51f7 1250 /* Used by the linker. */
b39096a4
SC
1251#define BSF_KEEP 0x10000
1252#define BSF_KEEP_G 0x80000
332b6327 1253
355e5a8e 1254 /* Unused; should be deleted? */
b39096a4
SC
1255#define BSF_WEAK 0x100000
1256#define BSF_CTOR 0x200000
9a7c5449 1257
bc718e87
JG
1258 /* This symbol was created to point to a section, e.g. ELF's
1259 STT_SECTION symbols. */
9a7c5449 1260#define BSF_SECTION_SYM 0x400000
332b6327
SC
1261
1262 /* The symbol used to be a common symbol, but now it is
1263 allocated. */
b39096a4 1264#define BSF_OLD_COMMON 0x800000
332b6327
SC
1265
1266 /* The default value for common data. */
b39096a4 1267#define BFD_FORT_COMM_DEFAULT_VALUE 0
332b6327
SC
1268
1269 /* In some files the type of a symbol sometimes alters its
1270 location in an output file - ie in coff a <<ISFCN>> symbol
1271 which is also <<C_EXT>> symbol appears where it was
1272 declared and not at the end of a section. This bit is set
1273 by the target BFD part to convey this information. */
1274
b39096a4 1275#define BSF_NOT_AT_END 0x40000
332b6327
SC
1276
1277 /* Signal that the symbol is the label of constructor section. */
b39096a4 1278#define BSF_CONSTRUCTOR 0x1000000
332b6327
SC
1279
1280 /* Signal that the symbol is a warning symbol. If the symbol
1281 is a warning symbol, then the value field (I know this is
1282 tacky) will point to the asymbol which when referenced will
1283 cause the warning. */
b39096a4 1284#define BSF_WARNING 0x2000000
332b6327
SC
1285
1286 /* Signal that the symbol is indirect. The value of the symbol
1287 is a pointer to an undefined asymbol which contains the
1288 name to use instead. */
bc718e87
JG
1289#define BSF_INDIRECT 0x4000000
1290
1291 /* BSF_FILE marks symbols that contain a file name. This is used
1292 for ELF STT_FILE symbols. */
1293#define BSF_FILE 0x08000000
332b6327 1294
b39096a4 1295 flagword flags;
332b6327 1296
9a7c5449
SC
1297 /* A pointer to the section to which this symbol is
1298 relative. This will always be non NULL, there are special
1299 sections for undefined and absolute symbols */
b39096a4 1300 struct sec *section;
332b6327
SC
1301
1302 /* Back end special data. This is being phased out in favour
1303 of making this a union. */
355e5a8e
KR
1304 PTR udata;
1305
b39096a4 1306} asymbol;
b39096a4
SC
1307#define get_symtab_upper_bound(abfd) \
1308 BFD_SEND (abfd, _get_symtab_upper_bound, (abfd))
b39096a4
SC
1309#define bfd_canonicalize_symtab(abfd, location) \
1310 BFD_SEND (abfd, _bfd_canonicalize_symtab,\
1311 (abfd, location))
18fe0e9f
JG
1312boolean
1313bfd_set_symtab PARAMS ((bfd *, asymbol **, unsigned int ));
1314
1315void
1316bfd_print_symbol_vandf PARAMS ((PTR file, asymbol *symbol));
1317
b39096a4
SC
1318#define bfd_make_empty_symbol(abfd) \
1319 BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
d5ceae78
KR
1320#define bfd_make_debug_symbol(abfd,ptr,size) \
1321 BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
18fe0e9f
JG
1322int
1323bfd_decode_symclass PARAMS ((asymbol *symbol));
1324
b639b27b
SC
1325void
1326bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
1327
b39096a4
SC
1328struct _bfd
1329{
332b6327
SC
1330 /* The filename the application opened the BFD with. */
1331 CONST char *filename;
1332
1333 /* A pointer to the target jump table. */
1334 struct bfd_target *xvec;
1335
1336 /* To avoid dragging too many header files into every file that
0aa70210 1337 includes `<<bfd.h>>', IOSTREAM has been declared as a "char
332b6327
SC
1338 *", and MTIME as a "long". Their correct types, to which they
1339 are cast when used, are "FILE *" and "time_t". The iostream
1340 is the result of an fopen on the filename. */
1341 char *iostream;
1342
1343 /* Is the file being cached */
1344
1345 boolean cacheable;
1346
1347 /* Marks whether there was a default target specified when the
1348 BFD was opened. This is used to select what matching algorithm
1349 to use to chose the back end. */
1350
1351 boolean target_defaulted;
1352
1353 /* The caching routines use these to maintain a
1354 least-recently-used list of BFDs */
1355
1356 struct _bfd *lru_prev, *lru_next;
1357
1358 /* When a file is closed by the caching routines, BFD retains
1359 state information on the file here:
1360 */
1361
1362 file_ptr where;
1363
1364 /* and here:*/
1365
1366 boolean opened_once;
1367
1368 /* Set if we have a locally maintained mtime value, rather than
1369 getting it from the file each time: */
1370
1371 boolean mtime_set;
1372
1373 /* File modified time, if mtime_set is true: */
1374
1375 long mtime;
1376
1377 /* Reserved for an unimplemented file locking extension.*/
1378
1379 int ifd;
1380
1381 /* The format which belongs to the BFD.*/
1382
1383 bfd_format format;
1384
1385 /* The direction the BFD was opened with*/
1386
1387 enum bfd_direction {no_direction = 0,
1388 read_direction = 1,
1389 write_direction = 2,
1390 both_direction = 3} direction;
1391
1392 /* Format_specific flags*/
1393
1394 flagword flags;
1395
1396 /* Currently my_archive is tested before adding origin to
1397 anything. I believe that this can become always an add of
1398 origin, with origin set to 0 for non archive files. */
1399
1400 file_ptr origin;
1401
1402 /* Remember when output has begun, to stop strange things
1403 happening. */
1404 boolean output_has_begun;
1405
1406 /* Pointer to linked list of sections*/
1407 struct sec *sections;
1408
1409 /* The number of sections */
1410 unsigned int section_count;
1411
1412 /* Stuff only useful for object files:
1413 The start address. */
1414 bfd_vma start_address;
1415
1416 /* Used for input and output*/
1417 unsigned int symcount;
1418
1419 /* Symbol table for output BFD*/
1420 struct symbol_cache_entry **outsymbols;
1421
1422 /* Pointer to structure which contains architecture information*/
1423 struct bfd_arch_info *arch_info;
1424
1425 /* Stuff only useful for archives:*/
1426 PTR arelt_data;
1427 struct _bfd *my_archive;
1428 struct _bfd *next;
1429 struct _bfd *archive_head;
1430 boolean has_armap;
1431
1432 /* Used by the back end to hold private data. */
332b6327 1433
9a7c5449
SC
1434 union
1435 {
1436 struct aout_data_struct *aout_data;
1437 struct artdata *aout_ar_data;
1438 struct _oasys_data *oasys_obj_data;
1439 struct _oasys_ar_data *oasys_ar_data;
1440 struct coff_tdata *coff_obj_data;
06c3865a 1441 struct ecoff_tdata *ecoff_obj_data;
9a7c5449
SC
1442 struct ieee_data_struct *ieee_data;
1443 struct ieee_ar_data_struct *ieee_ar_data;
1444 struct srec_data_struct *srec_data;
8cedecca 1445 struct tekhex_data_struct *tekhex_data;
3ce7a824 1446 struct elf_obj_tdata *elf_obj_data;
9a7c5449
SC
1447 struct bout_data_struct *bout_data;
1448 struct sun_core_struct *sun_core_data;
2b74083c 1449 struct trad_core_struct *trad_core_data;
d63a3da9 1450 struct hppa_data_struct *hppa_data;
808566e8 1451 struct hppa_core_struct *hppa_core_data;
882885d3 1452 struct sgi_core_struct *sgi_core_data;
9a7c5449
SC
1453 PTR any;
1454 } tdata;
1455
332b6327
SC
1456 /* Used by the application to hold private data*/
1457 PTR usrdata;
1458
1459 /* Where all the allocated stuff under this BFD goes */
1460 struct obstack memory;
9a7c5449 1461
d5ceae78 1462 /* Is this really needed in addition to usrdata? */
9a7c5449 1463 asymbol **ld_symbols;
b39096a4 1464};
332b6327 1465
18fe0e9f
JG
1466unsigned int
1467bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
1468
1469unsigned int
1470bfd_canonicalize_reloc
1471 PARAMS ((bfd *abfd,
332b6327
SC
1472 asection *sec,
1473 arelent **loc,
1474 asymbol **syms));
18fe0e9f
JG
1475
1476boolean
1477bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
1478
1479void
1480bfd_set_reloc
1481 PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count)
332b6327
SC
1482
1483 );
18fe0e9f
JG
1484
1485boolean
1486bfd_set_start_address PARAMS ((bfd *, bfd_vma));
1487
1488long
1489bfd_get_mtime PARAMS ((bfd *));
1490
7917455f 1491long
fa754be2
FF
1492bfd_get_size PARAMS ((bfd *));
1493
285a08ad
ILT
1494int
1495bfd_get_gp_size PARAMS ((bfd *));
1496
1497void
1498bfd_set_gp_size PARAMS ((bfd *, int));
1499
b39096a4
SC
1500#define bfd_sizeof_headers(abfd, reloc) \
1501 BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
1502
332b6327
SC
1503#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
1504 BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line))
b39096a4 1505
d5ceae78 1506 /* Do these three do anything useful at all, for any back end? */
b39096a4
SC
1507#define bfd_debug_info_start(abfd) \
1508 BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
1509
1510#define bfd_debug_info_end(abfd) \
1511 BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
1512
1513#define bfd_debug_info_accumulate(abfd, section) \
1514 BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
1515
d5ceae78 1516
b39096a4
SC
1517#define bfd_stat_arch_elt(abfd, stat) \
1518 BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
1519
b39096a4
SC
1520#define bfd_set_arch_mach(abfd, arch, mach)\
1521 BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
7f3d9f46 1522
870f29f5
ILT
1523#define bfd_get_relocated_section_contents(abfd, seclet, data, relocateable) \
1524 BFD_SEND (abfd, _bfd_get_relocated_section_contents, (abfd, seclet, data, relocateable))
2d690b0a 1525
daa91756
SC
1526#define bfd_relax_section(abfd, section, symbols) \
1527 BFD_SEND (abfd, _bfd_relax_section, (abfd, section, symbols))
870f29f5
ILT
1528
1529#define bfd_seclet_link(abfd, data, relocateable) \
1530 BFD_SEND (abfd, _bfd_seclet_link, (abfd, data, relocateable))
18fe0e9f
JG
1531symindex
1532bfd_get_next_mapent PARAMS ((bfd *, symindex previous, carsym ** sym));
1533
1534boolean
1535bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
1536
1537bfd *
1538bfd_get_elt_at_index PARAMS ((bfd * archive, int index));
1539
1540bfd*
1541bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
1542
1543CONST char *
1544bfd_core_file_failing_command PARAMS ((bfd *));
1545
1546int
1547bfd_core_file_failing_signal PARAMS ((bfd *));
1548
1549boolean
1550core_file_matches_executable_p
1551 PARAMS ((bfd *core_bfd, bfd *exec_bfd));
1552
7a276b09
SC
1553#define BFD_SEND(bfd, message, arglist) \
1554 ((*((bfd)->xvec->message)) arglist)
7a276b09
SC
1555#define BFD_SEND_FMT(bfd, message, arglist) \
1556 (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
7a276b09
SC
1557typedef struct bfd_target
1558{
7a276b09 1559 char *name;
81f8fee9
JG
1560 enum target_flavour {
1561 bfd_target_unknown_flavour,
1562 bfd_target_aout_flavour,
1563 bfd_target_coff_flavour,
06c3865a 1564 bfd_target_ecoff_flavour,
81f8fee9
JG
1565 bfd_target_elf_flavour,
1566 bfd_target_ieee_flavour,
1567 bfd_target_oasys_flavour,
c3089ec9 1568 bfd_target_tekhex_flavour,
5e511f6f
SG
1569 bfd_target_srec_flavour,
1570 bfd_target_hppa_flavour} flavour;
7a276b09 1571 boolean byteorder_big_p;
7a276b09 1572 boolean header_byteorder_big_p;
7a276b09 1573 flagword object_flags;
7a276b09 1574 flagword section_flags;
ab414d87 1575 char symbol_leading_char;
7a276b09 1576 char ar_pad_char;
a4c22791 1577 unsigned short ar_max_namelen;
7a276b09 1578 unsigned int align_power_min;
a4c22791 1579 bfd_vma (*bfd_getx64) PARAMS ((bfd_byte *));
14e3c2e4 1580 bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((bfd_byte *));
a4c22791
JG
1581 void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
1582 bfd_vma (*bfd_getx32) PARAMS ((bfd_byte *));
14e3c2e4 1583 bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((bfd_byte *));
a4c22791
JG
1584 void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
1585 bfd_vma (*bfd_getx16) PARAMS ((bfd_byte *));
14e3c2e4 1586 bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((bfd_byte *));
a4c22791
JG
1587 void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
1588 bfd_vma (*bfd_h_getx64) PARAMS ((bfd_byte *));
14e3c2e4 1589 bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((bfd_byte *));
a4c22791
JG
1590 void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
1591 bfd_vma (*bfd_h_getx32) PARAMS ((bfd_byte *));
14e3c2e4 1592 bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((bfd_byte *));
a4c22791
JG
1593 void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
1594 bfd_vma (*bfd_h_getx16) PARAMS ((bfd_byte *));
14e3c2e4 1595 bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((bfd_byte *));
a4c22791
JG
1596 void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
1597 struct bfd_target * (*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
1598 boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
1599 boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
1600 char * (*_core_file_failing_command) PARAMS ((bfd *));
1601 int (*_core_file_failing_signal) PARAMS ((bfd *));
1602 boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
1603 boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
1604 boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
1605 void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
1606 boolean (*write_armap) PARAMS ((bfd *arch,
7a276b09
SC
1607 unsigned int elength,
1608 struct orl *map,
a0788ae3 1609 unsigned int orl_count,
7a276b09 1610 int stridx));
a4c22791
JG
1611 boolean (*_close_and_cleanup) PARAMS ((bfd *));
1612 boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
7a276b09 1613 file_ptr, bfd_size_type));
a4c22791 1614 boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
7a276b09 1615 file_ptr, bfd_size_type));
a4c22791
JG
1616 boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
1617 unsigned int (*_get_symtab_upper_bound) PARAMS ((bfd *));
1618 unsigned int (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
1619 struct symbol_cache_entry **));
1620 unsigned int (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
1621 unsigned int (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
1622 struct symbol_cache_entry **));
1623 struct symbol_cache_entry *
1624 (*_bfd_make_empty_symbol) PARAMS ((bfd *));
1625 void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
1626 struct symbol_cache_entry *,
81f8fee9 1627 bfd_print_symbol_type));
7a276b09 1628#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
b639b27b
SC
1629 void (*_bfd_get_symbol_info) PARAMS ((bfd *,
1630 struct symbol_cache_entry *,
1631 symbol_info *));
1632#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
a4c22791
JG
1633 alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
1634
1635 boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
1636 unsigned long));
1637
1638 bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
1639
1640 boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,
1641 struct sec *section, struct symbol_cache_entry **symbols,
1642 bfd_vma offset, CONST char **file, CONST char **func,
1643 unsigned int *line));
1644
1645 int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
1646
1647 int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
1648
1649 void (*_bfd_debug_info_start) PARAMS ((bfd *));
1650 void (*_bfd_debug_info_end) PARAMS ((bfd *));
1651 void (*_bfd_debug_info_accumulate) PARAMS ((bfd *, struct sec *));
1652
1653 bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
870f29f5
ILT
1654 struct bfd_seclet *, bfd_byte *data,
1655 boolean relocateable));
a4c22791
JG
1656
1657 boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
1658 struct symbol_cache_entry **));
870f29f5
ILT
1659
1660 boolean (*_bfd_seclet_link) PARAMS ((bfd *, PTR data,
1661 boolean relocateable));
d5ceae78 1662 /* See documentation on reloc types. */
a4c22791
JG
1663 CONST struct reloc_howto_struct *
1664 (*reloc_type_lookup) PARAMS ((bfd *abfd,
1665 bfd_reloc_code_real_type code));
d5ceae78 1666
a4c22791
JG
1667 /* Back-door to allow format-aware applications to create debug symbols
1668 while using BFD for everything else. Currently used by the assembler
d5ceae78 1669 when creating COFF files. */
a4c22791 1670 asymbol * (*_bfd_make_debug_symbol) PARAMS ((
d5ceae78
KR
1671 bfd *abfd,
1672 void *ptr,
1673 unsigned long size));
9a51287f 1674 PTR backend_data;
7a276b09 1675} bfd_target;
18fe0e9f
JG
1676bfd_target *
1677bfd_find_target PARAMS ((CONST char *, bfd *));
1678
1679CONST char **
1680bfd_target_list PARAMS ((void));
1681
1682boolean
1683bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
1684
1685boolean
1686bfd_set_format PARAMS ((bfd *, bfd_format));
1687
1688CONST char *
1689bfd_format_string PARAMS ((bfd_format));
1690
1484208f 1691#endif
This page took 0.161051 seconds and 4 git commands to generate.