1 /* BFD back-end data structures for ELF files.
2 Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
4 Written by Cygnus Support.
6 This file is part of BFD, the Binary File Descriptor library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
25 #include "elf/common.h"
26 #include "elf/internal.h"
27 #include "elf/external.h"
30 /* The number of entries in a section is its size divided by the size
31 of a single entry. This is normally only applicaable to reloc and
32 symbol table sections. */
33 #define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
35 /* If size isn't specified as 64 or 32, NAME macro should fail. */
38 #define NAME(x,y) CAT4(x,64,_,y)
41 #define NAME(x,y) CAT4(x,32,_,y)
46 #define NAME(x,y) CAT4(x,NOSIZE,_,y)
49 #define ElfNAME(X) NAME(Elf,X)
50 #define elfNAME(X) NAME(elf,X)
52 /* Information held for an ELF symbol. The first field is the
53 corresponding asymbol. Every symbol is an ELF file is actually a
54 pointer to this structure, although it is often handled as a
55 pointer to an asymbol. */
61 /* ELF symbol information. */
62 Elf_Internal_Sym internal_elf_sym
;
63 /* Backend specific information. */
66 unsigned int hppa_arg_reloc
;
72 /* Version information. This is from an Elf_Internal_Versym
73 structure in a SHT_GNU_versym section. It is zero if there is no
74 version information. */
75 unsigned short version
;
79 /* ELF linker hash table entries. */
81 struct elf_link_hash_entry
83 struct bfd_link_hash_entry root
;
85 /* Symbol index in output file. This is initialized to -1. It is
86 set to -2 if the symbol is used by a reloc. */
92 /* Symbol index as a dynamic symbol. Initialized to -1, and remains
93 -1 if this is not a dynamic symbol. */
94 /* ??? Note that this is consistently used as a synonym for tests
95 against whether we can perform various simplifying transformations
96 to the code. (E.g. changing a pc-relative jump to a PLT entry
97 into a pc-relative jump to the target function.) That test, which
98 is often relatively complex, and someplaces wrong or incomplete,
99 should really be replaced by a predicate in elflink.c.
101 End result: this field -1 does not indicate that the symbol is
102 not in the dynamic symbol table, but rather that the symbol is
103 not visible outside this DSO. */
106 /* String table index in .dynstr if this is a dynamic symbol. */
107 unsigned long dynstr_index
;
109 /* If this is a weak defined symbol from a dynamic object, this
110 field points to a defined symbol with the same value, if there is
111 one. Otherwise it is NULL. */
112 struct elf_link_hash_entry
*weakdef
;
114 /* If this symbol requires an entry in the global offset table, the
115 processor specific backend uses this field to track usage and
116 final offset. We use a union and two names primarily to document
117 the intent of any particular piece of code. The field should be
118 used as a count until size_dynamic_sections, at which point the
119 contents of the .got is fixed. Afterward, if this field is -1,
120 then the symbol does not require a global offset table entry. */
123 bfd_signed_vma refcount
;
127 /* Same, but tracks a procedure linkage table entry. */
130 bfd_signed_vma refcount
;
134 /* If this symbol is used in the linker created sections, the processor
135 specific backend uses this field to map the field into the offset
136 from the beginning of the section. */
137 struct elf_linker_section_pointers
*linker_section_pointer
;
139 /* Version information. */
142 /* This field is used for a symbol which is not defined in a
143 regular object. It points to the version information read in
144 from the dynamic object. */
145 Elf_Internal_Verdef
*verdef
;
146 /* This field is used for a symbol which is defined in a regular
147 object. It is set up in size_dynamic_sections. It points to
148 the version information we should write out for this symbol. */
149 struct bfd_elf_version_tree
*vertree
;
152 /* Virtual table entry use information. This array is nominally of size
153 size/sizeof(target_void_pointer), though we have to be able to assume
154 and track a size while the symbol is still undefined. It is indexed
155 via offset/sizeof(target_void_pointer). */
156 size_t vtable_entries_size
;
157 boolean
*vtable_entries_used
;
159 /* Virtual table derivation info. */
160 struct elf_link_hash_entry
*vtable_parent
;
162 /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
165 /* Symbol st_other value, symbol visibility. */
168 /* Hash value of the name computed using the ELF hash function. */
169 unsigned long elf_hash_value
;
171 /* Some flags; legal values follow. */
172 unsigned short elf_link_hash_flags
;
173 /* Symbol is referenced by a non-shared object. */
174 #define ELF_LINK_HASH_REF_REGULAR 01
175 /* Symbol is defined by a non-shared object. */
176 #define ELF_LINK_HASH_DEF_REGULAR 02
177 /* Symbol is referenced by a shared object. */
178 #define ELF_LINK_HASH_REF_DYNAMIC 04
179 /* Symbol is defined by a shared object. */
180 #define ELF_LINK_HASH_DEF_DYNAMIC 010
181 /* Symbol has a non-weak reference from a non-shared object. */
182 #define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
183 /* Dynamic symbol has been adjustd. */
184 #define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
185 /* Symbol needs a copy reloc. */
186 #define ELF_LINK_HASH_NEEDS_COPY 0100
187 /* Symbol needs a procedure linkage table entry. */
188 #define ELF_LINK_HASH_NEEDS_PLT 0200
189 /* Symbol appears in a non-ELF input file. */
190 #define ELF_LINK_NON_ELF 0400
191 /* Symbol should be marked as hidden in the version information. */
192 #define ELF_LINK_HIDDEN 01000
193 /* Symbol was forced to local scope due to a version script file. */
194 #define ELF_LINK_FORCED_LOCAL 02000
195 /* Symbol was marked during garbage collection. */
196 #define ELF_LINK_HASH_MARK 04000
197 /* Symbol is referenced by a non-GOT/non-PLT relocation. This is
198 not currently set by all the backends. */
199 #define ELF_LINK_NON_GOT_REF 010000
202 /* Records local symbols to be emitted in the dynamic symbol table. */
204 struct elf_link_local_dynamic_entry
206 struct elf_link_local_dynamic_entry
*next
;
208 /* The input bfd this symbol came from. */
211 /* The index of the local symbol being copied. */
214 /* The index in the outgoing dynamic symbol table. */
217 /* A copy of the input symbol. */
218 Elf_Internal_Sym isym
;
221 /* ELF linker hash table. */
223 struct elf_link_hash_table
225 struct bfd_link_hash_table root
;
226 /* Whether we have created the special dynamic sections required
227 when linking against or generating a shared object. */
228 boolean dynamic_sections_created
;
229 /* The BFD used to hold special sections created by the linker.
230 This will be the first BFD found which requires these sections to
233 /* The number of symbols found in the link which must be put into
234 the .dynsym section. */
235 bfd_size_type dynsymcount
;
236 /* The string table of dynamic symbols, which becomes the .dynstr
238 struct bfd_strtab_hash
*dynstr
;
239 /* The number of buckets in the hash table in the .hash section.
240 This is based on the number of dynamic symbols. */
241 bfd_size_type bucketcount
;
242 /* A linked list of DT_NEEDED names found in dynamic objects
243 included in the link. */
244 struct bfd_link_needed_list
*needed
;
245 /* The _GLOBAL_OFFSET_TABLE_ symbol. */
246 struct elf_link_hash_entry
*hgot
;
247 /* A pointer to information used to link stabs in sections. */
249 /* A pointer to information used to merge SEC_MERGE sections. */
251 /* A linked list of local symbols to be added to .dynsym. */
252 struct elf_link_local_dynamic_entry
*dynlocal
;
253 /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
254 objects included in the link. */
255 struct bfd_link_needed_list
*runpath
;
258 /* Look up an entry in an ELF linker hash table. */
260 #define elf_link_hash_lookup(table, string, create, copy, follow) \
261 ((struct elf_link_hash_entry *) \
262 bfd_link_hash_lookup (&(table)->root, (string), (create), \
265 /* Traverse an ELF linker hash table. */
267 #define elf_link_hash_traverse(table, func, info) \
268 (bfd_link_hash_traverse \
270 (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
273 /* Get the ELF linker hash table from a link_info structure. */
275 #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
277 /* Returns true if the hash table is a struct elf_link_hash_table. */
278 #define is_elf_hash_table(p) \
279 ((p)->hash->type == bfd_link_elf_hash_table)
281 /* Constant information held for an ELF backend. */
283 struct elf_size_info
{
284 unsigned char sizeof_ehdr
, sizeof_phdr
, sizeof_shdr
;
285 unsigned char sizeof_rel
, sizeof_rela
, sizeof_sym
, sizeof_dyn
, sizeof_note
;
287 /* The size of entries in the .hash section. */
288 unsigned char sizeof_hash_entry
;
290 /* The number of internal relocations to allocate per external
292 unsigned char int_rels_per_ext_rel
;
294 unsigned char arch_size
, file_align
;
295 unsigned char elfclass
, ev_current
;
296 int (*write_out_phdrs
)
297 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, unsigned int));
298 boolean (*write_shdrs_and_ehdr
)
301 PARAMS ((bfd
*, asection
*, PTR
));
302 void (*swap_symbol_out
)
303 PARAMS ((bfd
*, const Elf_Internal_Sym
*, PTR
));
304 boolean (*slurp_reloc_table
)
305 PARAMS ((bfd
*, asection
*, asymbol
**, boolean
));
306 long (*slurp_symbol_table
)
307 PARAMS ((bfd
*, asymbol
**, boolean
));
309 PARAMS ((bfd
*, const PTR
, Elf_Internal_Dyn
*));
311 PARAMS ((bfd
*, const Elf_Internal_Dyn
*, PTR
));
313 /* This function, if defined, is called to swap in a REL
314 relocation. If an external relocation corresponds to more than
315 one internal relocation, then all relocations are swapped in at
317 void (*swap_reloc_in
)
318 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rel
*));
320 /* This function, if defined, is called to swap out a REL
322 void (*swap_reloc_out
)
323 PARAMS ((bfd
*, const Elf_Internal_Rel
*, bfd_byte
*));
325 /* This function, if defined, is called to swap in a RELA
326 relocation. If an external relocation corresponds to more than
327 one internal relocation, then all relocations are swapped in at
329 void (*swap_reloca_in
)
330 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rela
*));
332 /* This function, if defined, is called to swap out a RELA
334 void (*swap_reloca_out
)
335 PARAMS ((bfd
*, const Elf_Internal_Rela
*, bfd_byte
*));
339 #define elf_symbol_from(ABFD,S) \
340 (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
341 && (S)->the_bfd->tdata.elf_obj_data != 0) \
342 ? (elf_symbol_type *) (S) \
345 enum elf_reloc_type_class
{
347 reloc_class_relative
,
352 struct elf_backend_data
354 /* The architecture for this backend. */
355 enum bfd_architecture arch
;
357 /* The ELF machine code (EM_xxxx) for this backend. */
358 int elf_machine_code
;
360 /* The maximum page size for this backend. */
363 /* A function to translate an ELF RELA relocation to a BFD arelent
365 void (*elf_info_to_howto
)
366 PARAMS ((bfd
*, arelent
*, Elf_Internal_Rela
*));
368 /* A function to translate an ELF REL relocation to a BFD arelent
370 void (*elf_info_to_howto_rel
)
371 PARAMS ((bfd
*, arelent
*, Elf_Internal_Rel
*));
373 /* A function to determine whether a symbol is global when
374 partitioning the symbol table into local and global symbols.
375 This should be NULL for most targets, in which case the correct
376 thing will be done. MIPS ELF, at least on the Irix 5, has
377 special requirements. */
378 boolean (*elf_backend_sym_is_global
)
379 PARAMS ((bfd
*, asymbol
*));
381 /* The remaining functions are hooks which are called only if they
384 /* A function to permit a backend specific check on whether a
385 particular BFD format is relevant for an object file, and to
386 permit the backend to set any global information it wishes. When
387 this is called elf_elfheader is set, but anything else should be
388 used with caution. If this returns false, the check_format
389 routine will return a bfd_error_wrong_format error. */
390 boolean (*elf_backend_object_p
)
393 /* A function to do additional symbol processing when reading the
394 ELF symbol table. This is where any processor-specific special
395 section indices are handled. */
396 void (*elf_backend_symbol_processing
)
397 PARAMS ((bfd
*, asymbol
*));
399 /* A function to do additional symbol processing after reading the
400 entire ELF symbol table. */
401 boolean (*elf_backend_symbol_table_processing
)
402 PARAMS ((bfd
*, elf_symbol_type
*, unsigned int));
404 /* A function to set the type of the info field. Processor-specific
405 types should be handled here. */
406 int (*elf_backend_get_symbol_type
)
407 PARAMS (( Elf_Internal_Sym
*, int));
409 /* A function to do additional processing on the ELF section header
410 just before writing it out. This is used to set the flags and
411 type fields for some sections, or to actually write out data for
413 boolean (*elf_backend_section_processing
)
414 PARAMS ((bfd
*, Elf32_Internal_Shdr
*));
416 /* A function to handle unusual section types when creating BFD
417 sections from ELF sections. */
418 boolean (*elf_backend_section_from_shdr
)
419 PARAMS ((bfd
*, Elf32_Internal_Shdr
*, char *));
421 /* A function to convert machine dependent section header flags to
422 BFD internal section header flags. */
423 boolean (*elf_backend_section_flags
)
424 PARAMS ((flagword
*, Elf32_Internal_Shdr
*));
426 /* A function to handle unusual program segment types when creating BFD
427 sections from ELF program segments. */
428 boolean (*elf_backend_section_from_phdr
)
429 PARAMS ((bfd
*, Elf32_Internal_Phdr
*, int));
431 /* A function to set up the ELF section header for a BFD section in
432 preparation for writing it out. This is where the flags and type
433 fields are set for unusual sections. */
434 boolean (*elf_backend_fake_sections
)
435 PARAMS ((bfd
*, Elf32_Internal_Shdr
*, asection
*));
437 /* A function to get the ELF section index for a BFD section. If
438 this returns true, the section was found. If it is a normal ELF
439 section, *RETVAL should be left unchanged. If it is not a normal
440 ELF section *RETVAL should be set to the SHN_xxxx index. */
441 boolean (*elf_backend_section_from_bfd_section
)
442 PARAMS ((bfd
*, Elf32_Internal_Shdr
*, asection
*, int *retval
));
444 /* If this field is not NULL, it is called by the add_symbols phase
445 of a link just before adding a symbol to the global linker hash
446 table. It may modify any of the fields as it wishes. If *NAME
447 is set to NULL, the symbol will be skipped rather than being
448 added to the hash table. This function is responsible for
449 handling all processor dependent symbol bindings and section
450 indices, and must set at least *FLAGS and *SEC for each processor
451 dependent case; failure to do so will cause a link error. */
452 boolean (*elf_add_symbol_hook
)
453 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
,
454 const Elf_Internal_Sym
*, const char **name
,
455 flagword
*flags
, asection
**sec
, bfd_vma
*value
));
457 /* If this field is not NULL, it is called by the elf_link_output_sym
458 phase of a link for each symbol which will appear in the object file. */
459 boolean (*elf_backend_link_output_symbol_hook
)
460 PARAMS ((bfd
*, struct bfd_link_info
*info
, const char *,
461 Elf_Internal_Sym
*, asection
*));
463 /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
464 linker the first time it encounters a dynamic object in the link.
465 This function must create any sections required for dynamic
466 linking. The ABFD argument is a dynamic object. The .interp,
467 .dynamic, .dynsym, .dynstr, and .hash functions have already been
468 created, and this function may modify the section flags if
469 desired. This function will normally create the .got and .plt
470 sections, but different backends have different requirements. */
471 boolean (*elf_backend_create_dynamic_sections
)
472 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
));
474 /* The CHECK_RELOCS function is called by the add_symbols phase of
475 the ELF backend linker. It is called once for each section with
476 relocs of an object file, just after the symbols for the object
477 file have been added to the global linker hash table. The
478 function must look through the relocs and do any special handling
479 required. This generally means allocating space in the global
480 offset table, and perhaps allocating space for a reloc. The
481 relocs are always passed as Rela structures; if the section
482 actually uses Rel structures, the r_addend field will always be
484 boolean (*check_relocs
)
485 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
, asection
*o
,
486 const Elf_Internal_Rela
*relocs
));
488 /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
489 linker for every symbol which is defined by a dynamic object and
490 referenced by a regular object. This is called after all the
491 input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
492 function has been called. The hash table entry should be
493 bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
494 defined in a section from a dynamic object. Dynamic object
495 sections are not included in the final link, and this function is
496 responsible for changing the value to something which the rest of
497 the link can deal with. This will normally involve adding an
498 entry to the .plt or .got or some such section, and setting the
499 symbol to point to that. */
500 boolean (*elf_backend_adjust_dynamic_symbol
)
501 PARAMS ((struct bfd_link_info
*info
, struct elf_link_hash_entry
*h
));
503 /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
504 after all the linker input files have been seen but before the
505 section sizes have been set. This is called after
506 ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */
507 boolean (*elf_backend_always_size_sections
)
508 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
));
510 /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
511 linker after all the linker input files have been seen but before
512 the sections sizes have been set. This is called after
513 ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
514 It is only called when linking against a dynamic object. It must
515 set the sizes of the dynamic sections, and may fill in their
516 contents as well. The generic ELF linker can handle the .dynsym,
517 .dynstr and .hash sections. This function must handle the
518 .interp section and any sections created by the
519 CREATE_DYNAMIC_SECTIONS entry point. */
520 boolean (*elf_backend_size_dynamic_sections
)
521 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
));
523 /* The RELOCATE_SECTION function is called by the ELF backend linker
524 to handle the relocations for a section.
526 The relocs are always passed as Rela structures; if the section
527 actually uses Rel structures, the r_addend field will always be
530 This function is responsible for adjust the section contents as
531 necessary, and (if using Rela relocs and generating a
532 relocateable output file) adjusting the reloc addend as
535 This function does not have to worry about setting the reloc
536 address or the reloc symbol index.
538 LOCAL_SYMS is a pointer to the swapped in local symbols.
540 LOCAL_SECTIONS is an array giving the section in the input file
541 corresponding to the st_shndx field of each local symbol.
543 The global hash table entry for the global symbols can be found
544 via elf_sym_hashes (input_bfd).
546 When generating relocateable output, this function must handle
547 STB_LOCAL/STT_SECTION symbols specially. The output symbol is
548 going to be the section symbol corresponding to the output
549 section, which means that the addend must be adjusted
551 boolean (*elf_backend_relocate_section
)
552 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
,
553 bfd
*input_bfd
, asection
*input_section
, bfd_byte
*contents
,
554 Elf_Internal_Rela
*relocs
, Elf_Internal_Sym
*local_syms
,
555 asection
**local_sections
));
557 /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
558 linker just before it writes a symbol out to the .dynsym section.
559 The processor backend may make any required adjustment to the
560 symbol. It may also take the opportunity to set contents of the
561 dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
562 all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
563 on those symbols which are defined by a dynamic object. */
564 boolean (*elf_backend_finish_dynamic_symbol
)
565 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
,
566 struct elf_link_hash_entry
*h
, Elf_Internal_Sym
*sym
));
568 /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
569 linker just before it writes all the dynamic sections out to the
570 output file. The FINISH_DYNAMIC_SYMBOL will have been called on
571 all dynamic symbols. */
572 boolean (*elf_backend_finish_dynamic_sections
)
573 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
));
575 /* A function to do any beginning processing needed for the ELF file
576 before building the ELF headers and computing file positions. */
577 void (*elf_backend_begin_write_processing
)
578 PARAMS ((bfd
*, struct bfd_link_info
*));
580 /* A function to do any final processing needed for the ELF file
581 before writing it out. The LINKER argument is true if this BFD
582 was created by the ELF backend linker. */
583 void (*elf_backend_final_write_processing
)
584 PARAMS ((bfd
*, boolean linker
));
586 /* This function is called by get_program_header_size. It should
587 return the number of additional program segments which this BFD
588 will need. It should return -1 on error. */
589 int (*elf_backend_additional_program_headers
)
592 /* This function is called to modify an existing segment map in a
593 backend specific fashion. */
594 boolean (*elf_backend_modify_segment_map
)
597 /* This function is called during section gc to discover the section a
598 particular relocation refers to. It need not be defined for hosts
599 that have no queer relocation types. */
600 asection
* (*gc_mark_hook
)
601 PARAMS ((bfd
*abfd
, struct bfd_link_info
*, Elf_Internal_Rela
*,
602 struct elf_link_hash_entry
*h
, Elf_Internal_Sym
*));
604 /* This function, if defined, is called during the sweep phase of gc
605 in order that a backend might update any data structures it might
607 boolean (*gc_sweep_hook
)
608 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
, asection
*o
,
609 const Elf_Internal_Rela
*relocs
));
611 /* This function, if defined, is called after the ELF headers have
612 been created. This allows for things like the OS and ABI versions
614 void (*elf_backend_post_process_headers
)
615 PARAMS ((bfd
*, struct bfd_link_info
*));
617 /* This function, if defined, prints a symbol to file and returns the
618 name of the symbol to be printed. It should return NULL to fall
619 back to default symbol printing. */
620 const char *(*elf_backend_print_symbol_all
)
621 PARAMS ((bfd
*, PTR
, asymbol
*));
623 /* This function, if defined, is called after all local symbols and
624 global symbols converted to locals are emited into the symtab
625 section. It allows the backend to emit special global symbols
626 not handled in the hash table. */
627 boolean (*elf_backend_output_arch_syms
)
628 PARAMS ((bfd
*, struct bfd_link_info
*, PTR
,
629 boolean (*) (PTR
, const char *, Elf_Internal_Sym
*, asection
*)));
631 /* Copy any information related to dynamic linking from a pre-existing
632 symbol IND to a newly created symbol DIR. */
633 void (*elf_backend_copy_indirect_symbol
)
634 PARAMS ((struct elf_link_hash_entry
*, struct elf_link_hash_entry
*));
636 /* Modify any information related to dynamic linking such that the
637 symbol is not exported. */
638 void (*elf_backend_hide_symbol
)
639 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*));
641 /* Emit relocations. Overrides default routine for emitting relocs,
642 except during a relocatable link, or if all relocs are being emitted. */
643 void (*elf_backend_emit_relocs
)
644 PARAMS ((bfd
*, asection
*, Elf_Internal_Shdr
*, Elf_Internal_Rela
*));
646 /* Count relocations. Not called for relocatable links
647 or if all relocs are being preserved in the output. */
648 unsigned int (*elf_backend_count_relocs
)
649 PARAMS ((asection
*, Elf_Internal_Rela
*));
651 /* This function, if defined, is called when an NT_PRSTATUS note is found
653 boolean (*elf_backend_grok_prstatus
)
654 PARAMS ((bfd
*, Elf_Internal_Note
*));
656 /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
657 note is found in a core file. */
658 boolean (*elf_backend_grok_psinfo
)
659 PARAMS ((bfd
*, Elf_Internal_Note
*));
661 /* Functions to print VMAs. Special code to handle 64 bit ELF files. */
662 void (* elf_backend_sprintf_vma
)
663 PARAMS ((bfd
*, char *, bfd_vma
));
664 void (* elf_backend_fprintf_vma
)
665 PARAMS ((bfd
*, PTR
, bfd_vma
));
667 /* This function returns class of a reloc type. */
668 enum elf_reloc_type_class (*elf_backend_reloc_type_class
)
669 PARAMS ((const Elf_Internal_Rela
*));
671 /* The swapping table to use when dealing with ECOFF information.
672 Used for the MIPS ELF .mdebug section. */
673 const struct ecoff_debug_swap
*elf_backend_ecoff_debug_swap
;
675 /* Alternate EM_xxxx machine codes for this backend. */
676 int elf_machine_alt1
;
677 int elf_machine_alt2
;
679 const struct elf_size_info
*s
;
681 /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
683 bfd_vma got_symbol_offset
;
685 /* The size in bytes of the headers for the GOT and PLT. This includes
686 the so-called reserved entries on some systems. */
687 bfd_vma got_header_size
;
688 bfd_vma plt_header_size
;
690 /* This is true if the linker should act like collect and gather
691 global constructors and destructors by name. This is true for
692 MIPS ELF because the Irix 5 tools can not handle the .init
694 unsigned collect
: 1;
696 /* This is true if the linker should ignore changes to the type of a
697 symbol. This is true for MIPS ELF because some Irix 5 objects
698 record undefined functions as STT_OBJECT although the definitions
700 unsigned type_change_ok
: 1;
702 /* Whether the backend may use REL relocations. (Some backends use
703 both REL and RELA relocations, and this flag is set for those
705 unsigned may_use_rel_p
: 1;
707 /* Whether the backend may use RELA relocations. (Some backends use
708 both REL and RELA relocations, and this flag is set for those
710 unsigned may_use_rela_p
: 1;
712 /* Whether the default relocation type is RELA. If a backend with
713 this flag set wants REL relocations for a particular section,
714 it must note that explicitly. Similarly, if this flag is clear,
715 and the backend wants RELA relocations for a particular
717 unsigned default_use_rela_p
: 1;
719 /* True if addresses "naturally" sign extend. This is used when
720 swapping in from Elf32 when BFD64. */
721 unsigned sign_extend_vma
: 1;
723 unsigned want_got_plt
: 1;
724 unsigned plt_readonly
: 1;
725 unsigned want_plt_sym
: 1;
726 unsigned plt_not_loaded
: 1;
727 unsigned plt_alignment
: 4;
728 unsigned can_gc_sections
: 1;
729 unsigned want_got_sym
: 1;
730 unsigned want_dynbss
: 1;
733 /* Information stored for each BFD section in an ELF file. This
734 structure is allocated by elf_new_section_hook. */
736 struct bfd_elf_section_data
738 /* The ELF header for this section. */
739 Elf_Internal_Shdr this_hdr
;
741 /* The ELF header for the reloc section associated with this
743 Elf_Internal_Shdr rel_hdr
;
745 /* If there is a second reloc section associated with this section,
746 as can happen on Irix 6, this field points to the header. */
747 Elf_Internal_Shdr
*rel_hdr2
;
749 /* The number of relocations currently assigned to REL_HDR. */
750 unsigned int rel_count
;
752 /* The number of relocations currently assigned to REL_HDR2. */
753 unsigned int rel_count2
;
755 /* The number of dynamic relocs copied for local symbols. */
756 unsigned int local_dynrel
;
758 /* A pointer to the bfd section used for dynamic relocs. */
761 /* The ELF section number of this section. Only used for an output
765 /* The ELF section number of the reloc section indicated by
766 REL_HDR if any. Only used for an output file. */
769 /* The ELF section number of the reloc section indicated by
770 REL_HDR2 if any. Only used for an output file. */
773 /* Used by the backend linker to store the symbol hash table entries
774 associated with relocs against global symbols. */
775 struct elf_link_hash_entry
**rel_hashes
;
777 /* A pointer to the swapped relocs. If the section uses REL relocs,
778 rather than RELA, all the r_addend fields will be zero. This
779 pointer may be NULL. It is used by the backend linker. */
780 Elf_Internal_Rela
*relocs
;
782 /* Used by the backend linker when generating a shared library to
783 record the dynamic symbol index for a section symbol
784 corresponding to this section. A value of 0 means that there is
785 no dynamic symbol for this section. */
788 /* A pointer used for .stab linking optimizations. */
791 /* A pointer used for SEC_MERGE optimizations. */
794 /* A pointer available for the processor specific ELF backend. */
797 /* Nonzero if this section uses RELA relocations, rather than REL. */
798 unsigned int use_rela_p
:1;
801 #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
803 #define get_elf_backend_data(abfd) \
804 ((struct elf_backend_data *) (abfd)->xvec->backend_data)
806 /* Enumeration to specify the special section. */
807 typedef enum elf_linker_section_enum
809 LINKER_SECTION_UNKNOWN
, /* not used */
810 LINKER_SECTION_GOT
, /* .got section for global offset pointers */
811 LINKER_SECTION_PLT
, /* .plt section for generated procedure stubs */
812 LINKER_SECTION_SDATA
, /* .sdata/.sbss section for PowerPC */
813 LINKER_SECTION_SDATA2
, /* .sdata2/.sbss2 section for PowerPC */
814 LINKER_SECTION_MAX
/* # of linker sections */
815 } elf_linker_section_enum_t
;
817 /* Sections created by the linker. */
819 typedef struct elf_linker_section
821 char *name
; /* name of the section */
822 char *rel_name
; /* name of the associated .rel{,a}. section */
823 char *bss_name
; /* name of a related .bss section */
824 char *sym_name
; /* name of symbol to reference this section */
825 asection
*section
; /* pointer to the section */
826 asection
*bss_section
; /* pointer to the bss section associated with this */
827 asection
*rel_section
; /* pointer to the relocations needed for this section */
828 struct elf_link_hash_entry
*sym_hash
; /* pointer to the created symbol hash value */
829 bfd_vma initial_size
; /* initial size before any linker generated allocations */
830 bfd_vma sym_offset
; /* offset of symbol from beginning of section */
831 bfd_vma hole_size
; /* size of reserved address hole in allocation */
832 bfd_vma hole_offset
; /* current offset for the hole */
833 bfd_vma max_hole_offset
; /* maximum offset for the hole */
834 elf_linker_section_enum_t which
; /* which section this is */
835 boolean hole_written_p
; /* whether the hole has been initialized */
836 unsigned int alignment
; /* alignment for the section */
837 flagword flags
; /* flags to use to create the section */
838 } elf_linker_section_t
;
840 /* Linked list of allocated pointer entries. This hangs off of the symbol lists, and
841 provides allows us to return different pointers, based on different addend's. */
843 typedef struct elf_linker_section_pointers
845 struct elf_linker_section_pointers
*next
; /* next allocated pointer for this symbol */
846 bfd_vma offset
; /* offset of pointer from beginning of section */
847 bfd_vma addend
; /* addend used */
848 elf_linker_section_enum_t which
; /* which linker section this is */
849 boolean written_address_p
; /* whether address was written yet */
850 } elf_linker_section_pointers_t
;
852 /* Some private data is stashed away for future use using the tdata pointer
853 in the bfd structure. */
857 Elf_Internal_Ehdr elf_header
[1]; /* Actual data, but ref like ptr */
858 Elf_Internal_Shdr
**elf_sect_ptr
;
859 Elf_Internal_Phdr
*phdr
;
860 struct elf_segment_map
*segment_map
;
861 struct bfd_strtab_hash
*strtab_ptr
;
864 int num_section_syms
;
865 asymbol
**section_syms
; /* STT_SECTION symbols for each section */
866 Elf_Internal_Shdr symtab_hdr
;
867 Elf_Internal_Shdr shstrtab_hdr
;
868 Elf_Internal_Shdr strtab_hdr
;
869 Elf_Internal_Shdr dynsymtab_hdr
;
870 Elf_Internal_Shdr dynstrtab_hdr
;
871 Elf_Internal_Shdr dynversym_hdr
;
872 Elf_Internal_Shdr dynverref_hdr
;
873 Elf_Internal_Shdr dynverdef_hdr
;
874 unsigned int symtab_section
, shstrtab_section
;
875 unsigned int strtab_section
, dynsymtab_section
;
876 unsigned int dynversym_section
, dynverdef_section
, dynverref_section
;
877 file_ptr next_file_pos
;
879 /* we don't need these inside bfd anymore, and I think
880 these weren't used outside bfd. */
881 void *prstatus
; /* The raw /proc prstatus structure */
882 void *prpsinfo
; /* The raw /proc prpsinfo structure */
884 bfd_vma gp
; /* The gp value (MIPS only, for now) */
885 unsigned int gp_size
; /* The gp size (MIPS only, for now) */
887 /* Information grabbed from an elf core file. */
894 /* This is set to true if the object was created by the backend
898 /* A mapping from external symbols to entries in the linker hash
899 table, used when linking. This is indexed by the symbol index
900 minus the sh_info field of the symbol table header. */
901 struct elf_link_hash_entry
**sym_hashes
;
903 /* A mapping from local symbols to offsets into the global offset
904 table, used when linking. This is indexed by the symbol index.
905 Like for the globals, we use a union and two names primarily to
906 document the intent of any particular piece of code. The field
907 should be used as a count until size_dynamic_sections, at which
908 point the contents of the .got is fixed. Afterward, if an entry
909 is -1, then the symbol does not require a global offset table entry. */
912 bfd_signed_vma
*refcounts
;
916 /* A mapping from local symbols to offsets into the various linker
917 sections added. This is index by the symbol index. */
918 elf_linker_section_pointers_t
**linker_section_pointers
;
920 /* The linker ELF emulation code needs to let the backend ELF linker
921 know what filename should be used for a dynamic object if the
922 dynamic object is found using a search. The emulation code then
923 sometimes needs to know what name was actually used. Until the
924 file has been added to the linker symbol table, this field holds
925 the name the linker wants. After it has been added, it holds the
926 name actually used, which will be the DT_SONAME entry if there is
930 /* When a reference in a regular object is resolved by a shared
931 object is loaded into via the DT_NEEDED entries by the linker
932 ELF emulation code, we need to add the shared object to the
933 DT_NEEDED list of the resulting binary to indicate the dependency
934 as if the -l option is passed to the linker. This field holds the
935 name of the loaded shared object. */
936 const char *dt_soname
;
938 /* Irix 5 often screws up the symbol table, sorting local symbols
939 after global symbols. This flag is set if the symbol table in
940 this BFD appears to be screwed up. If it is, we ignore the
941 sh_info field in the symbol table header, and always read all the
945 /* Records the result of `get_program_header_size'. */
946 bfd_size_type program_header_size
;
948 /* Used by find_nearest_line entry point. */
951 /* Used by MIPS ELF find_nearest_line entry point. The structure
952 could be included directly in this one, but there's no point to
953 wasting the memory just for the infrequently called
954 find_nearest_line. */
955 struct mips_elf_find_line
*find_line_info
;
957 /* A place to stash dwarf1 info for this bfd. */
958 struct dwarf1_debug
*dwarf1_find_line_info
;
960 /* A place to stash dwarf2 info for this bfd. */
961 PTR dwarf2_find_line_info
;
963 /* An array of stub sections indexed by symbol number, used by the
964 MIPS ELF linker. FIXME: We should figure out some way to only
965 include this field for a MIPS ELF target. */
966 asection
**local_stubs
;
968 /* Used to determine if the e_flags field has been initialized */
971 /* Number of symbol version definitions we are about to emit. */
972 unsigned int cverdefs
;
974 /* Number of symbol version references we are about to emit. */
975 unsigned int cverrefs
;
977 /* Symbol version definitions in external objects. */
978 Elf_Internal_Verdef
*verdef
;
980 /* Symbol version references to external objects. */
981 Elf_Internal_Verneed
*verref
;
983 /* Linker sections that we are interested in. */
984 struct elf_linker_section
*linker_section
[ (int)LINKER_SECTION_MAX
];
986 /* The Irix 5 support uses two virtual sections, which represent
987 text/data symbols defined in dynamic objects. */
988 asymbol
*elf_data_symbol
;
989 asymbol
*elf_text_symbol
;
990 asection
*elf_data_section
;
991 asection
*elf_text_section
;
994 #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
995 #define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
996 #define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
997 #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
998 #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
999 #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
1000 #define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
1001 #define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
1002 #define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
1003 #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
1004 #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
1005 #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
1006 #define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
1007 #define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
1008 #define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
1009 #define elf_gp(bfd) (elf_tdata(bfd) -> gp)
1010 #define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
1011 #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
1012 #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
1013 #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
1014 #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
1015 #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
1016 #define elf_dt_soname(bfd) (elf_tdata(bfd) -> dt_soname)
1017 #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
1018 #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
1019 #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
1021 extern void _bfd_elf_swap_verdef_in
1022 PARAMS ((bfd
*, const Elf_External_Verdef
*, Elf_Internal_Verdef
*));
1023 extern void _bfd_elf_swap_verdef_out
1024 PARAMS ((bfd
*, const Elf_Internal_Verdef
*, Elf_External_Verdef
*));
1025 extern void _bfd_elf_swap_verdaux_in
1026 PARAMS ((bfd
*, const Elf_External_Verdaux
*, Elf_Internal_Verdaux
*));
1027 extern void _bfd_elf_swap_verdaux_out
1028 PARAMS ((bfd
*, const Elf_Internal_Verdaux
*, Elf_External_Verdaux
*));
1029 extern void _bfd_elf_swap_verneed_in
1030 PARAMS ((bfd
*, const Elf_External_Verneed
*, Elf_Internal_Verneed
*));
1031 extern void _bfd_elf_swap_verneed_out
1032 PARAMS ((bfd
*, const Elf_Internal_Verneed
*, Elf_External_Verneed
*));
1033 extern void _bfd_elf_swap_vernaux_in
1034 PARAMS ((bfd
*, const Elf_External_Vernaux
*, Elf_Internal_Vernaux
*));
1035 extern void _bfd_elf_swap_vernaux_out
1036 PARAMS ((bfd
*, const Elf_Internal_Vernaux
*, Elf_External_Vernaux
*));
1037 extern void _bfd_elf_swap_versym_in
1038 PARAMS ((bfd
*, const Elf_External_Versym
*, Elf_Internal_Versym
*));
1039 extern void _bfd_elf_swap_versym_out
1040 PARAMS ((bfd
*, const Elf_Internal_Versym
*, Elf_External_Versym
*));
1042 extern int _bfd_elf_section_from_bfd_section
1043 PARAMS ((bfd
*, asection
*));
1044 extern char *bfd_elf_string_from_elf_section
1045 PARAMS ((bfd
*, unsigned, unsigned));
1046 extern char *bfd_elf_get_str_section
1047 PARAMS ((bfd
*, unsigned));
1049 extern boolean _bfd_elf_print_private_bfd_data
1050 PARAMS ((bfd
*, PTR
));
1051 extern void bfd_elf_print_symbol
1052 PARAMS ((bfd
*, PTR
, asymbol
*, bfd_print_symbol_type
));
1054 #define elf_string_from_elf_strtab(abfd, strindex) \
1055 bfd_elf_string_from_elf_section(abfd, elf_elfheader(abfd)->e_shstrndx, \
1058 #define bfd_elf32_print_symbol bfd_elf_print_symbol
1059 #define bfd_elf64_print_symbol bfd_elf_print_symbol
1061 extern void _bfd_elf_sprintf_vma
1062 PARAMS ((bfd
*, char *, bfd_vma
));
1063 extern void _bfd_elf_fprintf_vma
1064 PARAMS ((bfd
*, PTR
, bfd_vma
));
1066 extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
1067 PARAMS ((const Elf_Internal_Rela
*));
1069 extern unsigned long bfd_elf_hash
1070 PARAMS ((const char *));
1072 extern bfd_reloc_status_type bfd_elf_generic_reloc
1073 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1074 extern boolean bfd_elf_mkobject
1076 extern boolean bfd_elf_mkcorefile
1078 extern Elf_Internal_Shdr
*bfd_elf_find_section
1079 PARAMS ((bfd
*, char *));
1080 extern boolean _bfd_elf_make_section_from_shdr
1081 PARAMS ((bfd
*, Elf_Internal_Shdr
*, const char *));
1082 extern boolean _bfd_elf_make_section_from_phdr
1083 PARAMS ((bfd
*, Elf_Internal_Phdr
*, int, const char *));
1084 extern struct bfd_hash_entry
*_bfd_elf_link_hash_newfunc
1085 PARAMS ((struct bfd_hash_entry
*, struct bfd_hash_table
*, const char *));
1086 extern struct bfd_link_hash_table
*_bfd_elf_link_hash_table_create
1088 extern void _bfd_elf_link_hash_copy_indirect
1089 PARAMS ((struct elf_link_hash_entry
*, struct elf_link_hash_entry
*));
1090 extern void _bfd_elf_link_hash_hide_symbol
1091 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*));
1092 extern boolean _bfd_elf_link_hash_table_init
1093 PARAMS ((struct elf_link_hash_table
*, bfd
*,
1094 struct bfd_hash_entry
*(*) (struct bfd_hash_entry
*,
1095 struct bfd_hash_table
*,
1097 extern boolean _bfd_elf_slurp_version_tables
1100 extern boolean _bfd_elf_merge_sections
1101 PARAMS ((bfd
*, struct bfd_link_info
*));
1103 extern boolean _bfd_elf_copy_private_symbol_data
1104 PARAMS ((bfd
*, asymbol
*, bfd
*, asymbol
*));
1105 extern boolean _bfd_elf_copy_private_section_data
1106 PARAMS ((bfd
*, asection
*, bfd
*, asection
*));
1107 extern boolean _bfd_elf_write_object_contents
1109 extern boolean _bfd_elf_write_corefile_contents
1111 extern boolean _bfd_elf_set_section_contents
1112 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
1113 extern long _bfd_elf_get_symtab_upper_bound
1115 extern long _bfd_elf_get_symtab
1116 PARAMS ((bfd
*, asymbol
**));
1117 extern long _bfd_elf_get_dynamic_symtab_upper_bound
1119 extern long _bfd_elf_canonicalize_dynamic_symtab
1120 PARAMS ((bfd
*, asymbol
**));
1121 extern long _bfd_elf_get_reloc_upper_bound
1122 PARAMS ((bfd
*, sec_ptr
));
1123 extern long _bfd_elf_canonicalize_reloc
1124 PARAMS ((bfd
*, sec_ptr
, arelent
**, asymbol
**));
1125 extern long _bfd_elf_get_dynamic_reloc_upper_bound
1127 extern long _bfd_elf_canonicalize_dynamic_reloc
1128 PARAMS ((bfd
*, arelent
**, asymbol
**));
1129 extern asymbol
*_bfd_elf_make_empty_symbol
1131 extern void _bfd_elf_get_symbol_info
1132 PARAMS ((bfd
*, asymbol
*, symbol_info
*));
1133 extern boolean _bfd_elf_is_local_label_name
1134 PARAMS ((bfd
*, const char *));
1135 extern alent
*_bfd_elf_get_lineno
1136 PARAMS ((bfd
*, asymbol
*));
1137 extern boolean _bfd_elf_set_arch_mach
1138 PARAMS ((bfd
*, enum bfd_architecture
, unsigned long));
1139 extern boolean _bfd_elf_find_nearest_line
1140 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_vma
, const char **,
1141 const char **, unsigned int *));
1142 #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
1143 #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
1144 extern int _bfd_elf_sizeof_headers
1145 PARAMS ((bfd
*, boolean
));
1146 extern boolean _bfd_elf_new_section_hook
1147 PARAMS ((bfd
*, asection
*));
1148 extern boolean _bfd_elf_init_reloc_shdr
1149 PARAMS ((bfd
*, Elf_Internal_Shdr
*, asection
*, boolean
));
1151 /* If the target doesn't have reloc handling written yet: */
1152 extern void _bfd_elf_no_info_to_howto
1153 PARAMS ((bfd
*, arelent
*, Elf_Internal_Rela
*));
1155 extern boolean bfd_section_from_shdr
1156 PARAMS ((bfd
*, unsigned int shindex
));
1157 extern boolean bfd_section_from_phdr
1158 PARAMS ((bfd
*, Elf_Internal_Phdr
*, int));
1160 extern int _bfd_elf_symbol_from_bfd_symbol
1161 PARAMS ((bfd
*, asymbol
**));
1163 extern asection
*bfd_section_from_elf_index
1164 PARAMS ((bfd
*, unsigned int));
1165 extern boolean _bfd_elf_create_dynamic_sections
1166 PARAMS ((bfd
*, struct bfd_link_info
*));
1167 extern struct bfd_strtab_hash
*_bfd_elf_stringtab_init
1169 extern boolean _bfd_elf_link_record_dynamic_symbol
1170 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*));
1171 extern long _bfd_elf_link_lookup_local_dynindx
1172 PARAMS ((struct bfd_link_info
*, bfd
*, long));
1173 extern boolean _bfd_elf_compute_section_file_positions
1174 PARAMS ((bfd
*, struct bfd_link_info
*));
1175 extern void _bfd_elf_assign_file_positions_for_relocs
1177 extern file_ptr _bfd_elf_assign_file_position_for_section
1178 PARAMS ((Elf_Internal_Shdr
*, file_ptr
, boolean
));
1180 extern boolean _bfd_elf_validate_reloc
1181 PARAMS ((bfd
*, arelent
*));
1183 extern boolean _bfd_elf_create_dynamic_sections
1184 PARAMS ((bfd
*, struct bfd_link_info
*));
1185 extern boolean _bfd_elf_create_got_section
1186 PARAMS ((bfd
*, struct bfd_link_info
*));
1187 extern unsigned long _bfd_elf_link_renumber_dynsyms
1188 PARAMS ((bfd
*, struct bfd_link_info
*));
1190 extern boolean _bfd_elfcore_make_pseudosection
1191 PARAMS ((bfd
*, char *, size_t, ufile_ptr
));
1192 extern char *_bfd_elfcore_strndup
1193 PARAMS ((bfd
*, char *, size_t));
1195 extern elf_linker_section_t
*_bfd_elf_create_linker_section
1196 PARAMS ((bfd
*, struct bfd_link_info
*, enum elf_linker_section_enum
,
1197 elf_linker_section_t
*));
1199 extern elf_linker_section_pointers_t
*_bfd_elf_find_pointer_linker_section
1200 PARAMS ((elf_linker_section_pointers_t
*, bfd_vma
,
1201 elf_linker_section_enum_t
));
1203 extern boolean bfd_elf32_create_pointer_linker_section
1204 PARAMS ((bfd
*, struct bfd_link_info
*, elf_linker_section_t
*,
1205 struct elf_link_hash_entry
*, const Elf32_Internal_Rela
*));
1207 extern bfd_vma bfd_elf32_finish_pointer_linker_section
1208 PARAMS ((bfd
*, bfd
*, struct bfd_link_info
*, elf_linker_section_t
*,
1209 struct elf_link_hash_entry
*, bfd_vma
,
1210 const Elf32_Internal_Rela
*, int));
1212 extern boolean bfd_elf64_create_pointer_linker_section
1213 PARAMS ((bfd
*, struct bfd_link_info
*, elf_linker_section_t
*,
1214 struct elf_link_hash_entry
*, const Elf64_Internal_Rela
*));
1216 extern bfd_vma bfd_elf64_finish_pointer_linker_section
1217 PARAMS ((bfd
*, bfd
*, struct bfd_link_info
*, elf_linker_section_t
*,
1218 struct elf_link_hash_entry
*, bfd_vma
,
1219 const Elf64_Internal_Rela
*, int));
1221 extern boolean _bfd_elf_make_linker_section_rela
1222 PARAMS ((bfd
*, elf_linker_section_t
*, int));
1224 extern const bfd_target
*bfd_elf32_object_p
1226 extern const bfd_target
*bfd_elf32_core_file_p
1228 extern char *bfd_elf32_core_file_failing_command
1230 extern int bfd_elf32_core_file_failing_signal
1232 extern boolean bfd_elf32_core_file_matches_executable_p
1233 PARAMS ((bfd
*, bfd
*));
1235 extern boolean bfd_elf32_bfd_link_add_symbols
1236 PARAMS ((bfd
*, struct bfd_link_info
*));
1237 extern boolean bfd_elf32_bfd_final_link
1238 PARAMS ((bfd
*, struct bfd_link_info
*));
1240 extern void bfd_elf32_swap_symbol_in
1241 PARAMS ((bfd
*, const Elf32_External_Sym
*, Elf_Internal_Sym
*));
1242 extern void bfd_elf32_swap_symbol_out
1243 PARAMS ((bfd
*, const Elf_Internal_Sym
*, PTR
));
1244 extern void bfd_elf32_swap_reloc_in
1245 PARAMS ((bfd
*, const Elf32_External_Rel
*, Elf_Internal_Rel
*));
1246 extern void bfd_elf32_swap_reloc_out
1247 PARAMS ((bfd
*, const Elf_Internal_Rel
*, Elf32_External_Rel
*));
1248 extern void bfd_elf32_swap_reloca_in
1249 PARAMS ((bfd
*, const Elf32_External_Rela
*, Elf_Internal_Rela
*));
1250 extern void bfd_elf32_swap_reloca_out
1251 PARAMS ((bfd
*, const Elf_Internal_Rela
*, Elf32_External_Rela
*));
1252 extern void bfd_elf32_swap_phdr_in
1253 PARAMS ((bfd
*, const Elf32_External_Phdr
*, Elf_Internal_Phdr
*));
1254 extern void bfd_elf32_swap_phdr_out
1255 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, Elf32_External_Phdr
*));
1256 extern void bfd_elf32_swap_dyn_in
1257 PARAMS ((bfd
*, const PTR
, Elf_Internal_Dyn
*));
1258 extern void bfd_elf32_swap_dyn_out
1259 PARAMS ((bfd
*, const Elf_Internal_Dyn
*, PTR
));
1260 extern long bfd_elf32_slurp_symbol_table
1261 PARAMS ((bfd
*, asymbol
**, boolean
));
1262 extern boolean bfd_elf32_write_shdrs_and_ehdr
1264 extern int bfd_elf32_write_out_phdrs
1265 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, unsigned int));
1266 extern void bfd_elf32_write_relocs
1267 PARAMS ((bfd
*, asection
*, PTR
));
1268 extern boolean bfd_elf32_slurp_reloc_table
1269 PARAMS ((bfd
*, asection
*, asymbol
**, boolean
));
1270 extern boolean bfd_elf32_add_dynamic_entry
1271 PARAMS ((struct bfd_link_info
*, bfd_vma
, bfd_vma
));
1272 extern boolean bfd_elf32_link_create_dynamic_sections
1273 PARAMS ((bfd
*, struct bfd_link_info
*));
1274 extern Elf_Internal_Rela
*_bfd_elf32_link_read_relocs
1275 PARAMS ((bfd
*, asection
*, PTR
, Elf_Internal_Rela
*, boolean
));
1277 extern const bfd_target
*bfd_elf64_object_p
1279 extern const bfd_target
*bfd_elf64_core_file_p
1281 extern char *bfd_elf64_core_file_failing_command
1283 extern int bfd_elf64_core_file_failing_signal
1285 extern boolean bfd_elf64_core_file_matches_executable_p
1286 PARAMS ((bfd
*, bfd
*));
1287 extern boolean bfd_elf64_bfd_link_add_symbols
1288 PARAMS ((bfd
*, struct bfd_link_info
*));
1289 extern boolean bfd_elf64_bfd_final_link
1290 PARAMS ((bfd
*, struct bfd_link_info
*));
1292 extern void bfd_elf64_swap_symbol_in
1293 PARAMS ((bfd
*, const Elf64_External_Sym
*, Elf_Internal_Sym
*));
1294 extern void bfd_elf64_swap_symbol_out
1295 PARAMS ((bfd
*, const Elf_Internal_Sym
*, PTR
));
1296 extern void bfd_elf64_swap_reloc_in
1297 PARAMS ((bfd
*, const Elf64_External_Rel
*, Elf_Internal_Rel
*));
1298 extern void bfd_elf64_swap_reloc_out
1299 PARAMS ((bfd
*, const Elf_Internal_Rel
*, Elf64_External_Rel
*));
1300 extern void bfd_elf64_swap_reloca_in
1301 PARAMS ((bfd
*, const Elf64_External_Rela
*, Elf_Internal_Rela
*));
1302 extern void bfd_elf64_swap_reloca_out
1303 PARAMS ((bfd
*, const Elf_Internal_Rela
*, Elf64_External_Rela
*));
1304 extern void bfd_elf64_swap_phdr_in
1305 PARAMS ((bfd
*, const Elf64_External_Phdr
*, Elf_Internal_Phdr
*));
1306 extern void bfd_elf64_swap_phdr_out
1307 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, Elf64_External_Phdr
*));
1308 extern void bfd_elf64_swap_dyn_in
1309 PARAMS ((bfd
*, const PTR
, Elf_Internal_Dyn
*));
1310 extern void bfd_elf64_swap_dyn_out
1311 PARAMS ((bfd
*, const Elf_Internal_Dyn
*, PTR
));
1312 extern long bfd_elf64_slurp_symbol_table
1313 PARAMS ((bfd
*, asymbol
**, boolean
));
1314 extern boolean bfd_elf64_write_shdrs_and_ehdr
1316 extern int bfd_elf64_write_out_phdrs
1317 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, unsigned int));
1318 extern void bfd_elf64_write_relocs
1319 PARAMS ((bfd
*, asection
*, PTR
));
1320 extern boolean bfd_elf64_slurp_reloc_table
1321 PARAMS ((bfd
*, asection
*, asymbol
**, boolean
));
1322 extern boolean bfd_elf64_add_dynamic_entry
1323 PARAMS ((struct bfd_link_info
*, bfd_vma
, bfd_vma
));
1324 extern boolean bfd_elf64_link_create_dynamic_sections
1325 PARAMS ((bfd
*, struct bfd_link_info
*));
1326 extern Elf_Internal_Rela
*_bfd_elf64_link_read_relocs
1327 PARAMS ((bfd
*, asection
*, PTR
, Elf_Internal_Rela
*, boolean
));
1329 #define bfd_elf32_link_record_dynamic_symbol \
1330 _bfd_elf_link_record_dynamic_symbol
1331 #define bfd_elf64_link_record_dynamic_symbol \
1332 _bfd_elf_link_record_dynamic_symbol
1334 extern boolean _bfd_elf32_link_record_local_dynamic_symbol
1335 PARAMS ((struct bfd_link_info
*, bfd
*, long));
1336 extern boolean _bfd_elf64_link_record_local_dynamic_symbol
1337 PARAMS ((struct bfd_link_info
*, bfd
*, long));
1339 extern boolean _bfd_elf_close_and_cleanup
1341 extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
1342 PARAMS ((bfd
*, arelent
*, struct symbol_cache_entry
*, PTR
,
1343 asection
*, bfd
*, char **));
1345 extern boolean _bfd_elf32_gc_sections
1346 PARAMS ((bfd
*, struct bfd_link_info
*));
1347 extern boolean _bfd_elf32_gc_common_finalize_got_offsets
1348 PARAMS ((bfd
*, struct bfd_link_info
*));
1349 extern boolean _bfd_elf32_gc_common_final_link
1350 PARAMS ((bfd
*, struct bfd_link_info
*));
1351 extern boolean _bfd_elf32_gc_record_vtinherit
1352 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1353 extern boolean _bfd_elf32_gc_record_vtentry
1354 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1356 extern boolean _bfd_elf64_gc_sections
1357 PARAMS ((bfd
*, struct bfd_link_info
*));
1358 extern boolean _bfd_elf64_gc_common_finalize_got_offsets
1359 PARAMS ((bfd
*, struct bfd_link_info
*));
1360 extern boolean _bfd_elf64_gc_common_final_link
1361 PARAMS ((bfd
*, struct bfd_link_info
*));
1362 extern boolean _bfd_elf64_gc_record_vtinherit
1363 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1364 extern boolean _bfd_elf64_gc_record_vtentry
1365 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1367 /* MIPS ELF specific routines. */
1369 extern boolean _bfd_mips_elf_object_p
1371 extern boolean _bfd_mips_elf_section_from_shdr
1372 PARAMS ((bfd
*, Elf_Internal_Shdr
*, char *));
1373 extern boolean _bfd_mips_elf_fake_sections
1374 PARAMS ((bfd
*, Elf_Internal_Shdr
*, asection
*));
1375 extern boolean _bfd_mips_elf_section_from_bfd_section
1376 PARAMS ((bfd
*, Elf_Internal_Shdr
*, asection
*, int *));
1377 extern boolean _bfd_mips_elf_section_processing
1378 PARAMS ((bfd
*, Elf_Internal_Shdr
*));
1379 extern void _bfd_mips_elf_symbol_processing
1380 PARAMS ((bfd
*, asymbol
*));
1381 extern boolean _bfd_mips_elf_read_ecoff_info
1382 PARAMS ((bfd
*, asection
*, struct ecoff_debug_info
*));
1383 extern void _bfd_mips_elf_final_write_processing
1384 PARAMS ((bfd
*, boolean
));
1385 extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
1386 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1387 extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
1388 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1389 extern bfd_reloc_status_type _bfd_mips_elf_gprel16_reloc
1390 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1391 extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
1392 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1393 extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc
1394 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1395 extern boolean _bfd_mips_elf_set_private_flags
1396 PARAMS ((bfd
*, flagword
));
1397 extern boolean _bfd_mips_elf_copy_private_bfd_data
1398 PARAMS ((bfd
*, bfd
*));
1399 extern boolean _bfd_mips_elf_merge_private_bfd_data
1400 PARAMS ((bfd
*, bfd
*));
1401 extern boolean _bfd_mips_elf_find_nearest_line
1402 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_vma
, const char **,
1403 const char **, unsigned int *));
1404 extern boolean _bfd_mips_elf_set_section_contents
1405 PARAMS ((bfd
*, asection
*, PTR
, file_ptr
, bfd_size_type
));
1406 extern boolean _bfd_mips_elf_create_dynamic_sections
1407 PARAMS ((bfd
*, struct bfd_link_info
*));
1408 extern boolean _bfd_mips_elf_add_symbol_hook
1409 PARAMS ((bfd
*, struct bfd_link_info
*, const Elf_Internal_Sym
*,
1410 const char **, flagword
*, asection
**, bfd_vma
*));
1411 extern boolean _bfd_mips_elf_adjust_dynamic_symbol
1412 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*));
1413 extern boolean _bfd_mips_elf_finish_dynamic_symbol
1414 PARAMS ((bfd
*, struct bfd_link_info
*, struct elf_link_hash_entry
*,
1415 Elf_Internal_Sym
*));
1416 extern boolean _bfd_mips_elf_finish_dynamic_sections
1417 PARAMS ((bfd
*, struct bfd_link_info
*));
1418 extern asection
* _bfd_mips_elf_gc_mark_hook
1419 PARAMS ((bfd
*, struct bfd_link_info
*, Elf_Internal_Rela
*,
1420 struct elf_link_hash_entry
*, Elf_Internal_Sym
*));
1421 extern boolean _bfd_mips_elf_gc_sweep_hook
1422 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*,
1423 const Elf_Internal_Rela
*));
1424 extern boolean _bfd_mips_elf_always_size_sections
1425 PARAMS ((bfd
*, struct bfd_link_info
*));
1426 extern boolean _bfd_mips_elf_size_dynamic_sections
1427 PARAMS ((bfd
*, struct bfd_link_info
*));
1428 extern boolean _bfd_mips_elf_check_relocs
1429 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*,
1430 const Elf_Internal_Rela
*));
1431 extern struct bfd_link_hash_table
*_bfd_mips_elf_link_hash_table_create
1433 extern boolean _bfd_mips_elf_print_private_bfd_data
1434 PARAMS ((bfd
*, PTR
));
1435 extern boolean _bfd_mips_elf_link_output_symbol_hook
1436 PARAMS ((bfd
*, struct bfd_link_info
*, const char *, Elf_Internal_Sym
*,
1438 extern boolean _bfd_mips_elf_final_link
1439 PARAMS ((bfd
*, struct bfd_link_info
*));
1440 extern int _bfd_mips_elf_additional_program_headers
1442 extern boolean _bfd_mips_elf_modify_segment_map
1444 extern boolean _bfd_mips_elf_relocate_section
1445 PARAMS ((bfd
*, struct bfd_link_info
*, bfd
*, asection
*, bfd_byte
*,
1446 Elf_Internal_Rela
*, Elf_Internal_Sym
*, asection
**));
1448 /* SH ELF specific routine. */
1450 extern boolean _sh_elf_set_mach_from_flags
1453 #endif /* _LIBELF_H_ */