]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - bfd/elf-bfd.h
* hosts/alphalinux.h (TRAD_CORE_EXTRA_SIZE_ALLOWED): Expand to 4096.
[thirdparty/binutils-gdb.git] / bfd / elf-bfd.h
CommitLineData
252b5132
RH
1/* BFD back-end data structures for ELF files.
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
3 Written by Cygnus Support.
4
5This file is part of BFD, the Binary File Descriptor library.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21#ifndef _LIBELF_H_
22#define _LIBELF_H_ 1
23
24#include "elf/common.h"
25#include "elf/internal.h"
26#include "elf/external.h"
27#include "bfdlink.h"
28
29/* If size isn't specified as 64 or 32, NAME macro should fail. */
30#ifndef NAME
31#if ARCH_SIZE==64
32#define NAME(x,y) CAT4(x,64,_,y)
33#endif
34#if ARCH_SIZE==32
35#define NAME(x,y) CAT4(x,32,_,y)
36#endif
37#endif
38
39#ifndef NAME
40#define NAME(x,y) CAT4(x,NOSIZE,_,y)
41#endif
42
43#define ElfNAME(X) NAME(Elf,X)
44#define elfNAME(X) NAME(elf,X)
45
46/* Information held for an ELF symbol. The first field is the
47 corresponding asymbol. Every symbol is an ELF file is actually a
48 pointer to this structure, although it is often handled as a
49 pointer to an asymbol. */
50
51typedef struct
52{
53 /* The BFD symbol. */
54 asymbol symbol;
55 /* ELF symbol information. */
56 Elf_Internal_Sym internal_elf_sym;
57 /* Backend specific information. */
58 union
59 {
60 unsigned int hppa_arg_reloc;
61 PTR mips_extr;
62 PTR any;
63 }
64 tc_data;
65
66 /* Version information. This is from an Elf_Internal_Versym
67 structure in a SHT_GNU_versym section. It is zero if there is no
68 version information. */
69 unsigned short version;
70
71} elf_symbol_type;
72\f
73/* ELF linker hash table entries. */
74
75struct elf_link_hash_entry
76{
77 struct bfd_link_hash_entry root;
78
79 /* Symbol index in output file. This is initialized to -1. It is
80 set to -2 if the symbol is used by a reloc. */
81 long indx;
82
83 /* Symbol size. */
84 bfd_size_type size;
85
86 /* Symbol index as a dynamic symbol. Initialized to -1, and remains
87 -1 if this is not a dynamic symbol. */
88 long dynindx;
89
90 /* String table index in .dynstr if this is a dynamic symbol. */
91 unsigned long dynstr_index;
92
93 /* If this is a weak defined symbol from a dynamic object, this
94 field points to a defined symbol with the same value, if there is
95 one. Otherwise it is NULL. */
96 struct elf_link_hash_entry *weakdef;
97
98 /* If this symbol requires an entry in the global offset table, the
99 processor specific backend uses this field to track usage and
100 final offset. We use a union and two names primarily to document
101 the intent of any particular piece of code. The field should be
102 used as a count until size_dynamic_sections, at which point the
103 contents of the .got is fixed. Afterward, if this field is -1,
104 then the symbol does not require a global offset table entry. */
105 union
106 {
107 bfd_signed_vma refcount;
108 bfd_vma offset;
109 } got;
110
111 /* Same, but tracks a procedure linkage table entry. */
112 union
113 {
114 bfd_signed_vma refcount;
115 bfd_vma offset;
116 } plt;
117
118 /* If this symbol is used in the linker created sections, the processor
119 specific backend uses this field to map the field into the offset
120 from the beginning of the section. */
121 struct elf_linker_section_pointers *linker_section_pointer;
122
123 /* Version information. */
124 union
125 {
126 /* This field is used for a symbol which is not defined in a
127 regular object. It points to the version information read in
128 from the dynamic object. */
129 Elf_Internal_Verdef *verdef;
130 /* This field is used for a symbol which is defined in a regular
131 object. It is set up in size_dynamic_sections. It points to
132 the version information we should write out for this symbol. */
133 struct bfd_elf_version_tree *vertree;
134 } verinfo;
135
136 /* Virtual table entry use information. This array is nominally of size
137 size/sizeof(target_void_pointer), though we have to be able to assume
138 and track a size while the symbol is still undefined. It is indexed
139 via offset/sizeof(target_void_pointer). */
140 size_t vtable_entries_size;
141 boolean *vtable_entries_used;
142
143 /* Virtual table derivation info. */
144 struct elf_link_hash_entry *vtable_parent;
145
146 /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
147 char type;
148
149 /* Symbol st_other value. */
150 unsigned char other;
151
152 /* Hash value of the name computed using the ELF hash function. */
153 unsigned long elf_hash_value;
154
155 /* Some flags; legal values follow. */
156 unsigned short elf_link_hash_flags;
157 /* Symbol is referenced by a non-shared object. */
158#define ELF_LINK_HASH_REF_REGULAR 01
159 /* Symbol is defined by a non-shared object. */
160#define ELF_LINK_HASH_DEF_REGULAR 02
161 /* Symbol is referenced by a shared object. */
162#define ELF_LINK_HASH_REF_DYNAMIC 04
163 /* Symbol is defined by a shared object. */
164#define ELF_LINK_HASH_DEF_DYNAMIC 010
165 /* Symbol has a non-weak reference from a non-shared object. */
166#define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
167 /* Dynamic symbol has been adjustd. */
168#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
169 /* Symbol needs a copy reloc. */
170#define ELF_LINK_HASH_NEEDS_COPY 0100
171 /* Symbol needs a procedure linkage table entry. */
172#define ELF_LINK_HASH_NEEDS_PLT 0200
173 /* Symbol appears in a non-ELF input file. */
174#define ELF_LINK_NON_ELF 0400
175 /* Symbol should be marked as hidden in the version information. */
176#define ELF_LINK_HIDDEN 01000
177 /* Symbol was forced to local scope due to a version script file. */
178#define ELF_LINK_FORCED_LOCAL 02000
179 /* Symbol was marked during garbage collection. */
180#define ELF_LINK_HASH_MARK 04000
181};
182
183/* ELF linker hash table. */
184
185struct elf_link_hash_table
186{
187 struct bfd_link_hash_table root;
188 /* Whether we have created the special dynamic sections required
189 when linking against or generating a shared object. */
190 boolean dynamic_sections_created;
191 /* The BFD used to hold special sections created by the linker.
192 This will be the first BFD found which requires these sections to
193 be created. */
194 bfd *dynobj;
195 /* The number of symbols found in the link which must be put into
196 the .dynsym section. */
197 bfd_size_type dynsymcount;
198 /* The string table of dynamic symbols, which becomes the .dynstr
199 section. */
200 struct bfd_strtab_hash *dynstr;
201 /* The number of buckets in the hash table in the .hash section.
202 This is based on the number of dynamic symbols. */
203 bfd_size_type bucketcount;
204 /* A linked list of DT_NEEDED names found in dynamic objects
205 included in the link. */
206 struct bfd_link_needed_list *needed;
207 /* The _GLOBAL_OFFSET_TABLE_ symbol. */
208 struct elf_link_hash_entry *hgot;
209 /* A pointer to information used to link stabs in sections. */
210 PTR stab_info;
211};
212
213/* Look up an entry in an ELF linker hash table. */
214
215#define elf_link_hash_lookup(table, string, create, copy, follow) \
216 ((struct elf_link_hash_entry *) \
217 bfd_link_hash_lookup (&(table)->root, (string), (create), \
218 (copy), (follow)))
219
220/* Traverse an ELF linker hash table. */
221
222#define elf_link_hash_traverse(table, func, info) \
223 (bfd_link_hash_traverse \
224 (&(table)->root, \
225 (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
226 (info)))
227
228/* Get the ELF linker hash table from a link_info structure. */
229
230#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
231\f
232/* Constant information held for an ELF backend. */
233
234struct elf_size_info {
235 unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
236 unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
237
238 unsigned char arch_size, file_align;
239 unsigned char elfclass, ev_current;
240 int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
241 boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *));
242 void (*write_relocs) PARAMS ((bfd *, asection *, PTR));
243 void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
244 boolean (*slurp_reloc_table)
245 PARAMS ((bfd *, asection *, asymbol **, boolean));
246 long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean));
247 void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
248};
249
250#define elf_symbol_from(ABFD,S) \
251 (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
252 && (S)->the_bfd->tdata.elf_obj_data != 0) \
253 ? (elf_symbol_type *) (S) \
254 : 0)
255
256struct elf_backend_data
257{
258 /* Whether the backend uses REL or RELA relocations. FIXME: some
259 ELF backends use both. When we need to support one, this whole
260 approach will need to be changed. */
261 int use_rela_p;
262
263 /* The architecture for this backend. */
264 enum bfd_architecture arch;
265
266 /* The ELF machine code (EM_xxxx) for this backend. */
267 int elf_machine_code;
268
269 /* The maximum page size for this backend. */
270 bfd_vma maxpagesize;
271
272 /* This is true if the linker should act like collect and gather
273 global constructors and destructors by name. This is true for
274 MIPS ELF because the Irix 5 tools can not handle the .init
275 section. */
276 boolean collect;
277
278 /* This is true if the linker should ignore changes to the type of a
279 symbol. This is true for MIPS ELF because some Irix 5 objects
280 record undefined functions as STT_OBJECT although the definitions
281 are STT_FUNC. */
282 boolean type_change_ok;
283
284 /* A function to translate an ELF RELA relocation to a BFD arelent
285 structure. */
286 void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
287 Elf_Internal_Rela *));
288
289 /* A function to translate an ELF REL relocation to a BFD arelent
290 structure. */
291 void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *,
292 Elf_Internal_Rel *));
293
294 /* A function to determine whether a symbol is global when
295 partitioning the symbol table into local and global symbols.
296 This should be NULL for most targets, in which case the correct
297 thing will be done. MIPS ELF, at least on the Irix 5, has
298 special requirements. */
299 boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *));
300
301 /* The remaining functions are hooks which are called only if they
302 are not NULL. */
303
304 /* A function to permit a backend specific check on whether a
305 particular BFD format is relevant for an object file, and to
306 permit the backend to set any global information it wishes. When
307 this is called elf_elfheader is set, but anything else should be
308 used with caution. If this returns false, the check_format
309 routine will return a bfd_error_wrong_format error. */
310 boolean (*elf_backend_object_p) PARAMS ((bfd *));
311
312 /* A function to do additional symbol processing when reading the
313 ELF symbol table. This is where any processor-specific special
314 section indices are handled. */
315 void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *));
316
317 /* A function to do additional symbol processing after reading the
318 entire ELF symbol table. */
319 boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *,
320 elf_symbol_type *,
321 unsigned int));
322
323 /* A function to set the type of the info field. Processor-specific
324 types should be handled here. */
325 int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int));
326
327 /* A function to do additional processing on the ELF section header
328 just before writing it out. This is used to set the flags and
329 type fields for some sections, or to actually write out data for
330 unusual sections. */
331 boolean (*elf_backend_section_processing) PARAMS ((bfd *,
332 Elf32_Internal_Shdr *));
333
334 /* A function to handle unusual section types when creating BFD
335 sections from ELF sections. */
336 boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *,
337 Elf32_Internal_Shdr *,
338 char *));
339
340 /* A function to set up the ELF section header for a BFD section in
341 preparation for writing it out. This is where the flags and type
342 fields are set for unusual sections. */
343 boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *,
344 asection *));
345
346 /* A function to get the ELF section index for a BFD section. If
347 this returns true, the section was found. If it is a normal ELF
348 section, *RETVAL should be left unchanged. If it is not a normal
349 ELF section *RETVAL should be set to the SHN_xxxx index. */
350 boolean (*elf_backend_section_from_bfd_section)
351 PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
352
353 /* If this field is not NULL, it is called by the add_symbols phase
354 of a link just before adding a symbol to the global linker hash
355 table. It may modify any of the fields as it wishes. If *NAME
356 is set to NULL, the symbol will be skipped rather than being
357 added to the hash table. This function is responsible for
358 handling all processor dependent symbol bindings and section
359 indices, and must set at least *FLAGS and *SEC for each processor
360 dependent case; failure to do so will cause a link error. */
361 boolean (*elf_add_symbol_hook)
362 PARAMS ((bfd *abfd, struct bfd_link_info *info,
363 const Elf_Internal_Sym *, const char **name,
364 flagword *flags, asection **sec, bfd_vma *value));
365
366 /* If this field is not NULL, it is called by the elf_link_output_sym
367 phase of a link for each symbol which will appear in the object file. */
368 boolean (*elf_backend_link_output_symbol_hook)
369 PARAMS ((bfd *, struct bfd_link_info *info, const char *,
370 Elf_Internal_Sym *, asection *));
371
372 /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
373 linker the first time it encounters a dynamic object in the link.
374 This function must create any sections required for dynamic
375 linking. The ABFD argument is a dynamic object. The .interp,
376 .dynamic, .dynsym, .dynstr, and .hash functions have already been
377 created, and this function may modify the section flags if
378 desired. This function will normally create the .got and .plt
379 sections, but different backends have different requirements. */
380 boolean (*elf_backend_create_dynamic_sections)
381 PARAMS ((bfd *abfd, struct bfd_link_info *info));
382
383 /* The CHECK_RELOCS function is called by the add_symbols phase of
384 the ELF backend linker. It is called once for each section with
385 relocs of an object file, just after the symbols for the object
386 file have been added to the global linker hash table. The
387 function must look through the relocs and do any special handling
388 required. This generally means allocating space in the global
389 offset table, and perhaps allocating space for a reloc. The
390 relocs are always passed as Rela structures; if the section
391 actually uses Rel structures, the r_addend field will always be
392 zero. */
393 boolean (*check_relocs)
394 PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
395 const Elf_Internal_Rela *relocs));
396
397 /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
398 linker for every symbol which is defined by a dynamic object and
399 referenced by a regular object. This is called after all the
400 input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
401 function has been called. The hash table entry should be
402 bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
403 defined in a section from a dynamic object. Dynamic object
404 sections are not included in the final link, and this function is
405 responsible for changing the value to something which the rest of
406 the link can deal with. This will normally involve adding an
407 entry to the .plt or .got or some such section, and setting the
408 symbol to point to that. */
409 boolean (*elf_backend_adjust_dynamic_symbol)
410 PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
411
412 /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
413 after all the linker input files have been seen but before the
414 section sizes have been set. This is called after
415 ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */
416 boolean (*elf_backend_always_size_sections)
417 PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
418
419 /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
420 linker after all the linker input files have been seen but before
421 the sections sizes have been set. This is called after
422 ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
423 It is only called when linking against a dynamic object. It must
424 set the sizes of the dynamic sections, and may fill in their
425 contents as well. The generic ELF linker can handle the .dynsym,
426 .dynstr and .hash sections. This function must handle the
427 .interp section and any sections created by the
428 CREATE_DYNAMIC_SECTIONS entry point. */
429 boolean (*elf_backend_size_dynamic_sections)
430 PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
431
432 /* The RELOCATE_SECTION function is called by the ELF backend linker
433 to handle the relocations for a section.
434
435 The relocs are always passed as Rela structures; if the section
436 actually uses Rel structures, the r_addend field will always be
437 zero.
438
439 This function is responsible for adjust the section contents as
440 necessary, and (if using Rela relocs and generating a
441 relocateable output file) adjusting the reloc addend as
442 necessary.
443
444 This function does not have to worry about setting the reloc
445 address or the reloc symbol index.
446
447 LOCAL_SYMS is a pointer to the swapped in local symbols.
448
449 LOCAL_SECTIONS is an array giving the section in the input file
450 corresponding to the st_shndx field of each local symbol.
451
452 The global hash table entry for the global symbols can be found
453 via elf_sym_hashes (input_bfd).
454
455 When generating relocateable output, this function must handle
456 STB_LOCAL/STT_SECTION symbols specially. The output symbol is
457 going to be the section symbol corresponding to the output
458 section, which means that the addend must be adjusted
459 accordingly. */
460 boolean (*elf_backend_relocate_section)
461 PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
462 bfd *input_bfd, asection *input_section, bfd_byte *contents,
463 Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
464 asection **local_sections));
465
466 /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
467 linker just before it writes a symbol out to the .dynsym section.
468 The processor backend may make any required adjustment to the
469 symbol. It may also take the opportunity to set contents of the
470 dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
471 all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
472 on those symbols which are defined by a dynamic object. */
473 boolean (*elf_backend_finish_dynamic_symbol)
474 PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
475 struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
476
477 /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
478 linker just before it writes all the dynamic sections out to the
479 output file. The FINISH_DYNAMIC_SYMBOL will have been called on
480 all dynamic symbols. */
481 boolean (*elf_backend_finish_dynamic_sections)
482 PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
483
484 /* A function to do any beginning processing needed for the ELF file
485 before building the ELF headers and computing file positions. */
486 void (*elf_backend_begin_write_processing)
487 PARAMS ((bfd *, struct bfd_link_info *));
488
489 /* A function to do any final processing needed for the ELF file
490 before writing it out. The LINKER argument is true if this BFD
491 was created by the ELF backend linker. */
492 void (*elf_backend_final_write_processing)
493 PARAMS ((bfd *, boolean linker));
494
495 /* This function is called by get_program_header_size. It should
496 return the number of additional program segments which this BFD
497 will need. It should return -1 on error. */
498 int (*elf_backend_additional_program_headers) PARAMS ((bfd *));
499
500 /* This function is called to modify an existing segment map in a
501 backend specific fashion. */
502 boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *));
503
504 /* This function is called during section gc to discover the section a
505 particular relocation refers to. It need not be defined for hosts
506 that have no queer relocation types. */
507 asection * (*gc_mark_hook)
508 PARAMS ((bfd *abfd, struct bfd_link_info *, Elf_Internal_Rela *,
509 struct elf_link_hash_entry *h, Elf_Internal_Sym *));
510
511 /* This function, if defined, is called during the sweep phase of gc
512 in order that a backend might update any data structures it might
513 be maintaining. */
514 boolean (*gc_sweep_hook)
515 PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
516 const Elf_Internal_Rela *relocs));
517
e6c51ed4
NC
518 /* This function, if defined, is called after the ELF headers have
519 been created. This allows for things like the OS and ABI versions
520 to be changed. */
521 void (*elf_backend_post_process_headers)
522 PARAMS ((bfd *, struct bfd_link_info *));
523
252b5132
RH
524 /* The swapping table to use when dealing with ECOFF information.
525 Used for the MIPS ELF .mdebug section. */
526 const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
527
528 /* Alternate EM_xxxx machine codes for this backend. */
529 int elf_machine_alt1;
530 int elf_machine_alt2;
531
532 const struct elf_size_info *s;
533
534 /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
535 .got section */
536 bfd_vma got_symbol_offset;
537
538 /* The size in bytes of the headers for the GOT and PLT. This includes
539 the so-called reserved entries on some systems. */
540 bfd_vma got_header_size;
541 bfd_vma plt_header_size;
542
543 unsigned want_got_plt : 1;
544 unsigned plt_readonly : 1;
545 unsigned want_plt_sym : 1;
546 unsigned plt_not_loaded : 1;
547 unsigned plt_alignment : 4;
548 unsigned can_gc_sections : 1;
549};
550
551/* Information stored for each BFD section in an ELF file. This
552 structure is allocated by elf_new_section_hook. */
553
554struct bfd_elf_section_data
555{
556 /* The ELF header for this section. */
557 Elf_Internal_Shdr this_hdr;
558 /* The ELF header for the reloc section associated with this
559 section, if any. */
560 Elf_Internal_Shdr rel_hdr;
561 /* If there is a second reloc section associated with this section,
562 as can happen on Irix 6, this field points to the header. */
563 Elf_Internal_Shdr *rel_hdr2;
564 /* The ELF section number of this section. Only used for an output
565 file. */
566 int this_idx;
567 /* The ELF section number of the reloc section associated with this
568 section, if any. Only used for an output file. */
569 int rel_idx;
570 /* Used by the backend linker to store the symbol hash table entries
571 associated with relocs against global symbols. */
572 struct elf_link_hash_entry **rel_hashes;
573 /* A pointer to the swapped relocs. If the section uses REL relocs,
574 rather than RELA, all the r_addend fields will be zero. This
575 pointer may be NULL. It is used by the backend linker. */
576 Elf_Internal_Rela *relocs;
577 /* Used by the backend linker when generating a shared library to
578 record the dynamic symbol index for a section symbol
579 corresponding to this section. */
580 long dynindx;
581 /* A pointer used for .stab linking optimizations. */
582 PTR stab_info;
583 /* A pointer available for the processor specific ELF backend. */
584 PTR tdata;
585};
586
587#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
588
589#define get_elf_backend_data(abfd) \
590 ((struct elf_backend_data *) (abfd)->xvec->backend_data)
591
592/* Enumeration to specify the special section. */
593typedef enum elf_linker_section_enum
594{
595 LINKER_SECTION_UNKNOWN, /* not used */
596 LINKER_SECTION_GOT, /* .got section for global offset pointers */
597 LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */
598 LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */
599 LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */
600 LINKER_SECTION_MAX /* # of linker sections */
601} elf_linker_section_enum_t;
602
603/* Sections created by the linker. */
604
605typedef struct elf_linker_section
606{
607 char *name; /* name of the section */
608 char *rel_name; /* name of the associated .rel{,a}. section */
609 char *bss_name; /* name of a related .bss section */
610 char *sym_name; /* name of symbol to reference this section */
611 asection *section; /* pointer to the section */
612 asection *bss_section; /* pointer to the bss section associated with this */
613 asection *rel_section; /* pointer to the relocations needed for this section */
614 struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */
615 bfd_vma initial_size; /* initial size before any linker generated allocations */
616 bfd_vma sym_offset; /* offset of symbol from beginning of section */
617 bfd_vma hole_size; /* size of reserved address hole in allocation */
618 bfd_vma hole_offset; /* current offset for the hole */
619 bfd_vma max_hole_offset; /* maximum offset for the hole */
620 elf_linker_section_enum_t which; /* which section this is */
621 boolean hole_written_p; /* whether the hole has been initialized */
622 unsigned int alignment; /* alignment for the section */
623 flagword flags; /* flags to use to create the section */
624} elf_linker_section_t;
625
626/* Linked list of allocated pointer entries. This hangs off of the symbol lists, and
627 provides allows us to return different pointers, based on different addend's. */
628
629typedef struct elf_linker_section_pointers
630{
631 struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */
632 bfd_vma offset; /* offset of pointer from beginning of section */
633 bfd_signed_vma addend; /* addend used */
634 elf_linker_section_enum_t which; /* which linker section this is */
635 boolean written_address_p; /* whether address was written yet */
636} elf_linker_section_pointers_t;
637
638/* Some private data is stashed away for future use using the tdata pointer
639 in the bfd structure. */
640
641struct elf_obj_tdata
642{
643 Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */
644 Elf_Internal_Shdr **elf_sect_ptr;
645 Elf_Internal_Phdr *phdr;
646 struct elf_segment_map *segment_map;
647 struct bfd_strtab_hash *strtab_ptr;
648 int num_locals;
649 int num_globals;
650 asymbol **section_syms; /* STT_SECTION symbols for each section */
651 Elf_Internal_Shdr symtab_hdr;
652 Elf_Internal_Shdr shstrtab_hdr;
653 Elf_Internal_Shdr strtab_hdr;
654 Elf_Internal_Shdr dynsymtab_hdr;
655 Elf_Internal_Shdr dynstrtab_hdr;
656 Elf_Internal_Shdr dynversym_hdr;
657 Elf_Internal_Shdr dynverref_hdr;
658 Elf_Internal_Shdr dynverdef_hdr;
659 unsigned int symtab_section, shstrtab_section;
660 unsigned int strtab_section, dynsymtab_section;
661 unsigned int dynversym_section, dynverdef_section, dynverref_section;
662 file_ptr next_file_pos;
663#if 0
664 /* we don't need these inside bfd anymore, and I think
665 these weren't used outside bfd. */
666 void *prstatus; /* The raw /proc prstatus structure */
667 void *prpsinfo; /* The raw /proc prpsinfo structure */
668#endif
669 bfd_vma gp; /* The gp value (MIPS only, for now) */
670 unsigned int gp_size; /* The gp size (MIPS only, for now) */
671
672 /* Information grabbed from an elf core file. */
673 int core_signal;
674 int core_pid;
675 int core_lwpid;
676 char* core_program;
677 char* core_command;
678
679 /* This is set to true if the object was created by the backend
680 linker. */
681 boolean linker;
682
683 /* A mapping from external symbols to entries in the linker hash
684 table, used when linking. This is indexed by the symbol index
685 minus the sh_info field of the symbol table header. */
686 struct elf_link_hash_entry **sym_hashes;
687
688 /* A mapping from local symbols to offsets into the global offset
689 table, used when linking. This is indexed by the symbol index.
690 Like for the globals, we use a union and two names primarily to
691 document the intent of any particular piece of code. The field
692 should be used as a count until size_dynamic_sections, at which
693 point the contents of the .got is fixed. Afterward, if an entry
694 is -1, then the symbol does not require a global offset table entry. */
695 union
696 {
697 bfd_signed_vma *refcounts;
698 bfd_vma *offsets;
699 } local_got;
700
701 /* A mapping from local symbols to offsets into the various linker
702 sections added. This is index by the symbol index. */
703 elf_linker_section_pointers_t **linker_section_pointers;
704
705 /* The linker ELF emulation code needs to let the backend ELF linker
706 know what filename should be used for a dynamic object if the
707 dynamic object is found using a search. The emulation code then
708 sometimes needs to know what name was actually used. Until the
709 file has been added to the linker symbol table, this field holds
710 the name the linker wants. After it has been added, it holds the
711 name actually used, which will be the DT_SONAME entry if there is
712 one. */
713 const char *dt_name;
714
715 /* Irix 5 often screws up the symbol table, sorting local symbols
716 after global symbols. This flag is set if the symbol table in
717 this BFD appears to be screwed up. If it is, we ignore the
718 sh_info field in the symbol table header, and always read all the
719 symbols. */
720 boolean bad_symtab;
721
722 /* Records the result of `get_program_header_size'. */
723 bfd_size_type program_header_size;
724
725 /* Used by find_nearest_line entry point. */
726 PTR line_info;
727
728 /* Used by MIPS ELF find_nearest_line entry point. The structure
729 could be included directly in this one, but there's no point to
730 wasting the memory just for the infrequently called
731 find_nearest_line. */
732 struct mips_elf_find_line *find_line_info;
733
734 /* A place to stash dwarf1 info for this bfd. */
735 struct dwarf1_debug *dwarf1_find_line_info;
736
737 /* A place to stash dwarf2 info for this bfd. */
738 struct dwarf2_debug *dwarf2_find_line_info;
739
740 /* An array of stub sections indexed by symbol number, used by the
741 MIPS ELF linker. FIXME: We should figure out some way to only
742 include this field for a MIPS ELF target. */
743 asection **local_stubs;
744
745 /* Used to determine if the e_flags field has been initialized */
746 boolean flags_init;
747
748 /* Number of symbol version definitions we are about to emit. */
749 unsigned int cverdefs;
750
751 /* Number of symbol version references we are about to emit. */
752 unsigned int cverrefs;
753
754 /* Symbol version definitions in external objects. */
755 Elf_Internal_Verdef *verdef;
756
757 /* Symbol version references to external objects. */
758 Elf_Internal_Verneed *verref;
759
760 /* Linker sections that we are interested in. */
761 struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
762};
763
764#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
765#define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
766#define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
767#define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
768#define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
769#define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
770#define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
771#define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
772#define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
773#define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
774#define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
775#define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
776#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
777#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
778#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
779#define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
780#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
781#define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
782#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
783#define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
784#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
785#define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
786#define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
787#define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
788\f
789extern void _bfd_elf_swap_verdef_in
790 PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *));
791extern void _bfd_elf_swap_verdef_out
792 PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *));
793extern void _bfd_elf_swap_verdaux_in
794 PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *));
795extern void _bfd_elf_swap_verdaux_out
796 PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *));
797extern void _bfd_elf_swap_verneed_in
798 PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *));
799extern void _bfd_elf_swap_verneed_out
800 PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *));
801extern void _bfd_elf_swap_vernaux_in
802 PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *));
803extern void _bfd_elf_swap_vernaux_out
804 PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *));
805extern void _bfd_elf_swap_versym_in
806 PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *));
807extern void _bfd_elf_swap_versym_out
808 PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *));
809
810extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *));
811extern char *bfd_elf_string_from_elf_section
812 PARAMS ((bfd *, unsigned, unsigned));
813extern char *bfd_elf_get_str_section PARAMS ((bfd *, unsigned));
814
815extern boolean _bfd_elf_print_private_bfd_data PARAMS ((bfd *, PTR));
816extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *,
817 bfd_print_symbol_type));
818#define elf_string_from_elf_strtab(abfd,strindex) \
819 bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex)
820
821#define bfd_elf32_print_symbol bfd_elf_print_symbol
822#define bfd_elf64_print_symbol bfd_elf_print_symbol
823
824extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *));
825
826extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
827 arelent *,
828 asymbol *,
829 PTR,
830 asection *,
831 bfd *,
832 char **));
833extern boolean bfd_elf_mkobject PARAMS ((bfd *));
834extern boolean bfd_elf_mkcorefile PARAMS ((bfd *));
835extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
836extern boolean _bfd_elf_make_section_from_shdr
837 PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name));
838extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
839 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
840extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
841 PARAMS ((bfd *));
842extern boolean _bfd_elf_link_hash_table_init
843 PARAMS ((struct elf_link_hash_table *, bfd *,
844 struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
845 struct bfd_hash_table *,
846 const char *)));
847extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *));
848
849extern boolean _bfd_elf_copy_private_symbol_data
850 PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
851extern boolean _bfd_elf_copy_private_section_data
852 PARAMS ((bfd *, asection *, bfd *, asection *));
853extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *));
854extern boolean _bfd_elf_write_corefile_contents PARAMS ((bfd *));
855extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
856 file_ptr,
857 bfd_size_type));
858extern long _bfd_elf_get_symtab_upper_bound PARAMS ((bfd *));
859extern long _bfd_elf_get_symtab PARAMS ((bfd *, asymbol **));
860extern long _bfd_elf_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
861extern long _bfd_elf_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **));
862extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
863extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
864 arelent **, asymbol **));
865extern long _bfd_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
866extern long _bfd_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **,
867 asymbol **));
868extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *));
869extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *,
870 symbol_info *));
871extern boolean _bfd_elf_is_local_label_name PARAMS ((bfd *, const char *));
872extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *));
873extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
874 unsigned long));
875extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *,
876 asymbol **,
877 bfd_vma, CONST char **,
878 CONST char **,
879 unsigned int *));
880#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
881#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
882extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean));
883extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *));
884
885/* If the target doesn't have reloc handling written yet: */
886extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *,
887 Elf_Internal_Rela *));
888
889extern boolean bfd_section_from_shdr PARAMS ((bfd *, unsigned int shindex));
890extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *, int));
891
892extern int _bfd_elf_symbol_from_bfd_symbol PARAMS ((bfd *, asymbol **));
893
894asection *bfd_section_from_elf_index PARAMS ((bfd *, unsigned int));
895boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
896 struct bfd_link_info *));
897struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void));
898boolean
899_bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *,
900 struct elf_link_hash_entry *));
901boolean
902_bfd_elf_compute_section_file_positions PARAMS ((bfd *,
903 struct bfd_link_info *));
904void _bfd_elf_assign_file_positions_for_relocs PARAMS ((bfd *));
905file_ptr _bfd_elf_assign_file_position_for_section PARAMS ((Elf_Internal_Shdr *,
906 file_ptr,
907 boolean));
908
909extern boolean _bfd_elf_validate_reloc PARAMS ((bfd *, arelent *));
910
911boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
912 struct bfd_link_info *));
913boolean _bfd_elf_create_got_section PARAMS ((bfd *,
914 struct bfd_link_info *));
915
916elf_linker_section_t *_bfd_elf_create_linker_section
917 PARAMS ((bfd *abfd,
918 struct bfd_link_info *info,
919 enum elf_linker_section_enum,
920 elf_linker_section_t *defaults));
921
922elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
923 PARAMS ((elf_linker_section_pointers_t *linker_pointers,
924 bfd_signed_vma addend,
925 elf_linker_section_enum_t which));
926
927boolean bfd_elf32_create_pointer_linker_section
928 PARAMS ((bfd *abfd,
929 struct bfd_link_info *info,
930 elf_linker_section_t *lsect,
931 struct elf_link_hash_entry *h,
932 const Elf32_Internal_Rela *rel));
933
934bfd_vma bfd_elf32_finish_pointer_linker_section
935 PARAMS ((bfd *output_abfd,
936 bfd *input_bfd,
937 struct bfd_link_info *info,
938 elf_linker_section_t *lsect,
939 struct elf_link_hash_entry *h,
940 bfd_vma relocation,
941 const Elf32_Internal_Rela *rel,
942 int relative_reloc));
943
944boolean bfd_elf64_create_pointer_linker_section
945 PARAMS ((bfd *abfd,
946 struct bfd_link_info *info,
947 elf_linker_section_t *lsect,
948 struct elf_link_hash_entry *h,
949 const Elf64_Internal_Rela *rel));
950
951bfd_vma bfd_elf64_finish_pointer_linker_section
952 PARAMS ((bfd *output_abfd,
953 bfd *input_bfd,
954 struct bfd_link_info *info,
955 elf_linker_section_t *lsect,
956 struct elf_link_hash_entry *h,
957 bfd_vma relocation,
958 const Elf64_Internal_Rela *rel,
959 int relative_reloc));
960
961boolean _bfd_elf_make_linker_section_rela
962 PARAMS ((bfd *dynobj,
963 elf_linker_section_t *lsect,
964 int alignment));
965
966boolean _bfd_elfcore_section_from_phdr
967 PARAMS ((bfd *, Elf_Internal_Phdr *, int));
968
969extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
970extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
971extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
972extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *));
973extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *,
974 bfd *));
975
976extern boolean bfd_elf32_bfd_link_add_symbols
977 PARAMS ((bfd *, struct bfd_link_info *));
978extern boolean bfd_elf32_bfd_final_link
979 PARAMS ((bfd *, struct bfd_link_info *));
980
981extern void bfd_elf32_swap_symbol_in
982 PARAMS ((bfd *, const Elf32_External_Sym *, Elf_Internal_Sym *));
983extern void bfd_elf32_swap_symbol_out
984 PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
985extern void bfd_elf32_swap_reloc_in
986 PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *));
987extern void bfd_elf32_swap_reloc_out
988 PARAMS ((bfd *, const Elf_Internal_Rel *, Elf32_External_Rel *));
989extern void bfd_elf32_swap_reloca_in
990 PARAMS ((bfd *, const Elf32_External_Rela *, Elf_Internal_Rela *));
991extern void bfd_elf32_swap_reloca_out
992 PARAMS ((bfd *, const Elf_Internal_Rela *, Elf32_External_Rela *));
993extern void bfd_elf32_swap_phdr_in
994 PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *));
995extern void bfd_elf32_swap_phdr_out
996 PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *));
997extern void bfd_elf32_swap_dyn_in
998 PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
999extern void bfd_elf32_swap_dyn_out
1000 PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf32_External_Dyn *));
1001extern long bfd_elf32_slurp_symbol_table
1002 PARAMS ((bfd *, asymbol **, boolean));
1003extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *));
1004extern int bfd_elf32_write_out_phdrs
1005 PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
1006extern boolean bfd_elf32_add_dynamic_entry
1007 PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
1008extern boolean bfd_elf32_link_create_dynamic_sections
1009 PARAMS ((bfd *, struct bfd_link_info *));
1010extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs
1011 PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
1012
1013extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *));
1014extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *));
1015extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *));
1016extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *));
1017extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *,
1018 bfd *));
1019extern boolean bfd_elf64_bfd_link_add_symbols
1020 PARAMS ((bfd *, struct bfd_link_info *));
1021extern boolean bfd_elf64_bfd_final_link
1022 PARAMS ((bfd *, struct bfd_link_info *));
1023
1024extern void bfd_elf64_swap_symbol_in
1025 PARAMS ((bfd *, const Elf64_External_Sym *, Elf_Internal_Sym *));
1026extern void bfd_elf64_swap_symbol_out
1027 PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
1028extern void bfd_elf64_swap_reloc_in
1029 PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *));
1030extern void bfd_elf64_swap_reloc_out
1031 PARAMS ((bfd *, const Elf_Internal_Rel *, Elf64_External_Rel *));
1032extern void bfd_elf64_swap_reloca_in
1033 PARAMS ((bfd *, const Elf64_External_Rela *, Elf_Internal_Rela *));
1034extern void bfd_elf64_swap_reloca_out
1035 PARAMS ((bfd *, const Elf_Internal_Rela *, Elf64_External_Rela *));
1036extern void bfd_elf64_swap_phdr_in
1037 PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *));
1038extern void bfd_elf64_swap_phdr_out
1039 PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *));
1040extern void bfd_elf64_swap_dyn_in
1041 PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
1042extern void bfd_elf64_swap_dyn_out
1043 PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf64_External_Dyn *));
1044extern long bfd_elf64_slurp_symbol_table
1045 PARAMS ((bfd *, asymbol **, boolean));
1046extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *));
1047extern int bfd_elf64_write_out_phdrs
1048 PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
1049extern boolean bfd_elf64_add_dynamic_entry
1050 PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
1051extern boolean bfd_elf64_link_create_dynamic_sections
1052 PARAMS ((bfd *, struct bfd_link_info *));
1053extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
1054 PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
1055
1056#define bfd_elf32_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
1057#define bfd_elf64_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
1058
1059extern boolean _bfd_elf_close_and_cleanup PARAMS ((bfd *));
1060extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
1061 PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR,
1062 asection *, bfd *, char **));
1063
1064boolean _bfd_elf32_gc_sections
1065 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1066boolean _bfd_elf32_gc_common_finalize_got_offsets
1067 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1068boolean _bfd_elf32_gc_common_final_link
1069 PARAMS ((bfd *, struct bfd_link_info *));
1070boolean _bfd_elf32_gc_record_vtinherit
1071 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1072boolean _bfd_elf32_gc_record_vtentry
1073 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1074
1075boolean _bfd_elf64_gc_sections
1076 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1077boolean _bfd_elf64_gc_common_finalize_got_offsets
1078 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1079boolean _bfd_elf64_gc_common_final_link
1080 PARAMS ((bfd *, struct bfd_link_info *));
1081boolean _bfd_elf64_gc_record_vtinherit
1082 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1083boolean _bfd_elf64_gc_record_vtentry
1084 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1085
1086/* MIPS ELF specific routines. */
1087
1088extern boolean _bfd_mips_elf_object_p PARAMS ((bfd *));
1089extern boolean _bfd_mips_elf_section_from_shdr
1090 PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
1091extern boolean _bfd_mips_elf_fake_sections
1092 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
1093extern boolean _bfd_mips_elf_section_from_bfd_section
1094 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, int *));
1095extern boolean _bfd_mips_elf_section_processing
1096 PARAMS ((bfd *, Elf_Internal_Shdr *));
1097extern void _bfd_mips_elf_symbol_processing PARAMS ((bfd *, asymbol *));
1098extern boolean _bfd_mips_elf_read_ecoff_info
1099 PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
1100extern void _bfd_mips_elf_final_write_processing PARAMS ((bfd *, boolean));
1101extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
1102 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1103extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
1104 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1105extern bfd_reloc_status_type _bfd_mips_elf_gprel16_reloc
1106 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1107extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
1108 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1109extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc
1110 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1111extern boolean _bfd_mips_elf_set_private_flags PARAMS ((bfd *, flagword));
1112extern boolean _bfd_mips_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *));
1113extern boolean _bfd_mips_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
1114extern boolean _bfd_mips_elf_find_nearest_line
1115 PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
1116 const char **, unsigned int *));
1117extern boolean _bfd_mips_elf_set_section_contents
1118 PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
1119
1120#endif /* _LIBELF_H_ */