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