* elflink.h (elf_link_create_dynamic_sections): Handle non-standard
[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
c7ac6ff8
MM
239 /* The size of entries in the .hash section. */
240 unsigned char sizeof_hash_entry;
241
242 /* The number of internal relocations to allocate per external
243 relocation entry. */
244 unsigned char int_rels_per_ext_rel;
245
252b5132
RH
246 unsigned char arch_size, file_align;
247 unsigned char elfclass, ev_current;
248 int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
249 boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *));
250 void (*write_relocs) PARAMS ((bfd *, asection *, PTR));
251 void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
252 boolean (*slurp_reloc_table)
253 PARAMS ((bfd *, asection *, asymbol **, boolean));
254 long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean));
255 void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
c7ac6ff8
MM
256 void (*swap_dyn_out) PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
257
258 /* This function, if defined, is called to swap in a REL
259 relocation. If an external relocation corresponds to more than
260 one internal relocation, then all relocations are swapped in at
261 once. */
262 void (*swap_reloc_in)
263 PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
264
265 /* This function, if defined, is called to swap out a REL
266 relocation. */
267 void (*swap_reloc_out)
268 PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
269
270 /* This function, if defined, is called to swap in a RELA
271 relocation. If an external relocation corresponds to more than
272 one internal relocation, then all relocations are swapped in at
273 once. */
274 void (*swap_reloca_in)
275 PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
276
277 /* This function, if defined, is called to swap out a RELA
278 relocation. */
279 void (*swap_reloca_out)
280 PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
281
252b5132
RH
282};
283
284#define elf_symbol_from(ABFD,S) \
285 (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
286 && (S)->the_bfd->tdata.elf_obj_data != 0) \
287 ? (elf_symbol_type *) (S) \
288 : 0)
289
290struct elf_backend_data
291{
252b5132
RH
292 /* The architecture for this backend. */
293 enum bfd_architecture arch;
294
295 /* The ELF machine code (EM_xxxx) for this backend. */
296 int elf_machine_code;
297
298 /* The maximum page size for this backend. */
299 bfd_vma maxpagesize;
300
301 /* This is true if the linker should act like collect and gather
302 global constructors and destructors by name. This is true for
303 MIPS ELF because the Irix 5 tools can not handle the .init
304 section. */
305 boolean collect;
306
307 /* This is true if the linker should ignore changes to the type of a
308 symbol. This is true for MIPS ELF because some Irix 5 objects
309 record undefined functions as STT_OBJECT although the definitions
310 are STT_FUNC. */
311 boolean type_change_ok;
312
313 /* A function to translate an ELF RELA relocation to a BFD arelent
314 structure. */
315 void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
316 Elf_Internal_Rela *));
317
318 /* A function to translate an ELF REL relocation to a BFD arelent
319 structure. */
320 void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *,
321 Elf_Internal_Rel *));
322
323 /* A function to determine whether a symbol is global when
324 partitioning the symbol table into local and global symbols.
325 This should be NULL for most targets, in which case the correct
326 thing will be done. MIPS ELF, at least on the Irix 5, has
327 special requirements. */
328 boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *));
329
330 /* The remaining functions are hooks which are called only if they
331 are not NULL. */
332
333 /* A function to permit a backend specific check on whether a
334 particular BFD format is relevant for an object file, and to
335 permit the backend to set any global information it wishes. When
336 this is called elf_elfheader is set, but anything else should be
337 used with caution. If this returns false, the check_format
338 routine will return a bfd_error_wrong_format error. */
339 boolean (*elf_backend_object_p) PARAMS ((bfd *));
340
341 /* A function to do additional symbol processing when reading the
342 ELF symbol table. This is where any processor-specific special
343 section indices are handled. */
344 void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *));
345
346 /* A function to do additional symbol processing after reading the
347 entire ELF symbol table. */
348 boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *,
349 elf_symbol_type *,
350 unsigned int));
351
352 /* A function to set the type of the info field. Processor-specific
353 types should be handled here. */
354 int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int));
355
356 /* A function to do additional processing on the ELF section header
357 just before writing it out. This is used to set the flags and
358 type fields for some sections, or to actually write out data for
359 unusual sections. */
360 boolean (*elf_backend_section_processing) PARAMS ((bfd *,
361 Elf32_Internal_Shdr *));
362
363 /* A function to handle unusual section types when creating BFD
364 sections from ELF sections. */
365 boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *,
366 Elf32_Internal_Shdr *,
367 char *));
368
369 /* A function to set up the ELF section header for a BFD section in
370 preparation for writing it out. This is where the flags and type
371 fields are set for unusual sections. */
372 boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *,
373 asection *));
374
375 /* A function to get the ELF section index for a BFD section. If
376 this returns true, the section was found. If it is a normal ELF
377 section, *RETVAL should be left unchanged. If it is not a normal
378 ELF section *RETVAL should be set to the SHN_xxxx index. */
379 boolean (*elf_backend_section_from_bfd_section)
380 PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
381
382 /* If this field is not NULL, it is called by the add_symbols phase
383 of a link just before adding a symbol to the global linker hash
384 table. It may modify any of the fields as it wishes. If *NAME
385 is set to NULL, the symbol will be skipped rather than being
386 added to the hash table. This function is responsible for
387 handling all processor dependent symbol bindings and section
388 indices, and must set at least *FLAGS and *SEC for each processor
389 dependent case; failure to do so will cause a link error. */
390 boolean (*elf_add_symbol_hook)
391 PARAMS ((bfd *abfd, struct bfd_link_info *info,
392 const Elf_Internal_Sym *, const char **name,
393 flagword *flags, asection **sec, bfd_vma *value));
394
395 /* If this field is not NULL, it is called by the elf_link_output_sym
396 phase of a link for each symbol which will appear in the object file. */
397 boolean (*elf_backend_link_output_symbol_hook)
398 PARAMS ((bfd *, struct bfd_link_info *info, const char *,
399 Elf_Internal_Sym *, asection *));
400
401 /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
402 linker the first time it encounters a dynamic object in the link.
403 This function must create any sections required for dynamic
404 linking. The ABFD argument is a dynamic object. The .interp,
405 .dynamic, .dynsym, .dynstr, and .hash functions have already been
406 created, and this function may modify the section flags if
407 desired. This function will normally create the .got and .plt
408 sections, but different backends have different requirements. */
409 boolean (*elf_backend_create_dynamic_sections)
410 PARAMS ((bfd *abfd, struct bfd_link_info *info));
411
412 /* The CHECK_RELOCS function is called by the add_symbols phase of
413 the ELF backend linker. It is called once for each section with
414 relocs of an object file, just after the symbols for the object
415 file have been added to the global linker hash table. The
416 function must look through the relocs and do any special handling
417 required. This generally means allocating space in the global
418 offset table, and perhaps allocating space for a reloc. The
419 relocs are always passed as Rela structures; if the section
420 actually uses Rel structures, the r_addend field will always be
421 zero. */
422 boolean (*check_relocs)
423 PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
424 const Elf_Internal_Rela *relocs));
425
426 /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
427 linker for every symbol which is defined by a dynamic object and
428 referenced by a regular object. This is called after all the
429 input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
430 function has been called. The hash table entry should be
431 bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
432 defined in a section from a dynamic object. Dynamic object
433 sections are not included in the final link, and this function is
434 responsible for changing the value to something which the rest of
435 the link can deal with. This will normally involve adding an
436 entry to the .plt or .got or some such section, and setting the
437 symbol to point to that. */
438 boolean (*elf_backend_adjust_dynamic_symbol)
439 PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
440
441 /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
442 after all the linker input files have been seen but before the
443 section sizes have been set. This is called after
444 ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */
445 boolean (*elf_backend_always_size_sections)
446 PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
447
448 /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
449 linker after all the linker input files have been seen but before
450 the sections sizes have been set. This is called after
451 ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
452 It is only called when linking against a dynamic object. It must
453 set the sizes of the dynamic sections, and may fill in their
454 contents as well. The generic ELF linker can handle the .dynsym,
455 .dynstr and .hash sections. This function must handle the
456 .interp section and any sections created by the
457 CREATE_DYNAMIC_SECTIONS entry point. */
458 boolean (*elf_backend_size_dynamic_sections)
459 PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
460
461 /* The RELOCATE_SECTION function is called by the ELF backend linker
462 to handle the relocations for a section.
463
464 The relocs are always passed as Rela structures; if the section
465 actually uses Rel structures, the r_addend field will always be
466 zero.
467
468 This function is responsible for adjust the section contents as
469 necessary, and (if using Rela relocs and generating a
470 relocateable output file) adjusting the reloc addend as
471 necessary.
472
473 This function does not have to worry about setting the reloc
474 address or the reloc symbol index.
475
476 LOCAL_SYMS is a pointer to the swapped in local symbols.
477
478 LOCAL_SECTIONS is an array giving the section in the input file
479 corresponding to the st_shndx field of each local symbol.
480
481 The global hash table entry for the global symbols can be found
482 via elf_sym_hashes (input_bfd).
483
484 When generating relocateable output, this function must handle
485 STB_LOCAL/STT_SECTION symbols specially. The output symbol is
486 going to be the section symbol corresponding to the output
487 section, which means that the addend must be adjusted
488 accordingly. */
489 boolean (*elf_backend_relocate_section)
490 PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
491 bfd *input_bfd, asection *input_section, bfd_byte *contents,
492 Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
493 asection **local_sections));
494
495 /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
496 linker just before it writes a symbol out to the .dynsym section.
497 The processor backend may make any required adjustment to the
498 symbol. It may also take the opportunity to set contents of the
499 dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
500 all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
501 on those symbols which are defined by a dynamic object. */
502 boolean (*elf_backend_finish_dynamic_symbol)
503 PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
504 struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
505
506 /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
507 linker just before it writes all the dynamic sections out to the
508 output file. The FINISH_DYNAMIC_SYMBOL will have been called on
509 all dynamic symbols. */
510 boolean (*elf_backend_finish_dynamic_sections)
511 PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
512
513 /* A function to do any beginning processing needed for the ELF file
514 before building the ELF headers and computing file positions. */
515 void (*elf_backend_begin_write_processing)
516 PARAMS ((bfd *, struct bfd_link_info *));
517
518 /* A function to do any final processing needed for the ELF file
519 before writing it out. The LINKER argument is true if this BFD
520 was created by the ELF backend linker. */
521 void (*elf_backend_final_write_processing)
522 PARAMS ((bfd *, boolean linker));
523
524 /* This function is called by get_program_header_size. It should
525 return the number of additional program segments which this BFD
526 will need. It should return -1 on error. */
527 int (*elf_backend_additional_program_headers) PARAMS ((bfd *));
528
529 /* This function is called to modify an existing segment map in a
530 backend specific fashion. */
531 boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *));
532
533 /* This function is called during section gc to discover the section a
534 particular relocation refers to. It need not be defined for hosts
535 that have no queer relocation types. */
536 asection * (*gc_mark_hook)
537 PARAMS ((bfd *abfd, struct bfd_link_info *, Elf_Internal_Rela *,
538 struct elf_link_hash_entry *h, Elf_Internal_Sym *));
539
540 /* This function, if defined, is called during the sweep phase of gc
541 in order that a backend might update any data structures it might
542 be maintaining. */
543 boolean (*gc_sweep_hook)
544 PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
545 const Elf_Internal_Rela *relocs));
546
e6c51ed4
NC
547 /* This function, if defined, is called after the ELF headers have
548 been created. This allows for things like the OS and ABI versions
549 to be changed. */
550 void (*elf_backend_post_process_headers)
551 PARAMS ((bfd *, struct bfd_link_info *));
552
252b5132
RH
553 /* The swapping table to use when dealing with ECOFF information.
554 Used for the MIPS ELF .mdebug section. */
555 const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
556
557 /* Alternate EM_xxxx machine codes for this backend. */
558 int elf_machine_alt1;
559 int elf_machine_alt2;
560
561 const struct elf_size_info *s;
562
563 /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
564 .got section */
565 bfd_vma got_symbol_offset;
566
567 /* The size in bytes of the headers for the GOT and PLT. This includes
568 the so-called reserved entries on some systems. */
569 bfd_vma got_header_size;
570 bfd_vma plt_header_size;
571
bf572ba0
MM
572 /* Whether the backend may use REL relocations. (Some backends use
573 both REL and RELA relocations, and this flag is set for those
574 backends.) */
575 unsigned may_use_rel_p : 1;
576
577 /* Whether the backend may use RELA relocations. (Some backends use
578 both REL and RELA relocations, and this flag is set for those
579 backends.) */
580 unsigned may_use_rela_p : 1;
581
582 /* Whether the default relocation type is RELA. If a backend with
583 this flag set wants REL relocations for a particular section,
584 it must note that explicitly. Similarly, if this flag is clear,
585 and the backend wants RELA relocations for a particular
586 section. */
587 unsigned default_use_rela_p : 1;
588
252b5132
RH
589 unsigned want_got_plt : 1;
590 unsigned plt_readonly : 1;
591 unsigned want_plt_sym : 1;
592 unsigned plt_not_loaded : 1;
593 unsigned plt_alignment : 4;
594 unsigned can_gc_sections : 1;
595};
596
597/* Information stored for each BFD section in an ELF file. This
598 structure is allocated by elf_new_section_hook. */
599
600struct bfd_elf_section_data
601{
602 /* The ELF header for this section. */
603 Elf_Internal_Shdr this_hdr;
604 /* The ELF header for the reloc section associated with this
605 section, if any. */
606 Elf_Internal_Shdr rel_hdr;
607 /* If there is a second reloc section associated with this section,
608 as can happen on Irix 6, this field points to the header. */
609 Elf_Internal_Shdr *rel_hdr2;
23bc299b
MM
610 /* The number of relocations currently assigned to REL_HDR. */
611 unsigned int rel_count;
612 /* The number of relocations currently assigned to REL_HDR2. */
613 unsigned int rel_count2;
252b5132
RH
614 /* The ELF section number of this section. Only used for an output
615 file. */
616 int this_idx;
23bc299b
MM
617 /* The ELF section number of the reloc section indicated by
618 REL_HDR if any. Only used for an output file. */
252b5132 619 int rel_idx;
23bc299b
MM
620 /* The ELF section number of the reloc section indicated by
621 REL_HDR2 if any. Only used for an output file. */
622 int rel_idx2;
252b5132
RH
623 /* Used by the backend linker to store the symbol hash table entries
624 associated with relocs against global symbols. */
625 struct elf_link_hash_entry **rel_hashes;
626 /* A pointer to the swapped relocs. If the section uses REL relocs,
627 rather than RELA, all the r_addend fields will be zero. This
628 pointer may be NULL. It is used by the backend linker. */
629 Elf_Internal_Rela *relocs;
630 /* Used by the backend linker when generating a shared library to
631 record the dynamic symbol index for a section symbol
75945f9f
ILT
632 corresponding to this section. A value of 0 means that there is
633 no dynamic symbol for this section. */
252b5132
RH
634 long dynindx;
635 /* A pointer used for .stab linking optimizations. */
636 PTR stab_info;
637 /* A pointer available for the processor specific ELF backend. */
638 PTR tdata;
bf572ba0
MM
639 /* Nonzero if this section uses RELA relocations, rather than REL. */
640 unsigned int use_rela_p:1;
252b5132
RH
641};
642
643#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
644
645#define get_elf_backend_data(abfd) \
646 ((struct elf_backend_data *) (abfd)->xvec->backend_data)
647
648/* Enumeration to specify the special section. */
649typedef enum elf_linker_section_enum
650{
651 LINKER_SECTION_UNKNOWN, /* not used */
652 LINKER_SECTION_GOT, /* .got section for global offset pointers */
653 LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */
654 LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */
655 LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */
656 LINKER_SECTION_MAX /* # of linker sections */
657} elf_linker_section_enum_t;
658
659/* Sections created by the linker. */
660
661typedef struct elf_linker_section
662{
663 char *name; /* name of the section */
664 char *rel_name; /* name of the associated .rel{,a}. section */
665 char *bss_name; /* name of a related .bss section */
666 char *sym_name; /* name of symbol to reference this section */
667 asection *section; /* pointer to the section */
668 asection *bss_section; /* pointer to the bss section associated with this */
669 asection *rel_section; /* pointer to the relocations needed for this section */
670 struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */
671 bfd_vma initial_size; /* initial size before any linker generated allocations */
672 bfd_vma sym_offset; /* offset of symbol from beginning of section */
673 bfd_vma hole_size; /* size of reserved address hole in allocation */
674 bfd_vma hole_offset; /* current offset for the hole */
675 bfd_vma max_hole_offset; /* maximum offset for the hole */
676 elf_linker_section_enum_t which; /* which section this is */
677 boolean hole_written_p; /* whether the hole has been initialized */
678 unsigned int alignment; /* alignment for the section */
679 flagword flags; /* flags to use to create the section */
680} elf_linker_section_t;
681
682/* Linked list of allocated pointer entries. This hangs off of the symbol lists, and
683 provides allows us to return different pointers, based on different addend's. */
684
685typedef struct elf_linker_section_pointers
686{
687 struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */
688 bfd_vma offset; /* offset of pointer from beginning of section */
689 bfd_signed_vma addend; /* addend used */
690 elf_linker_section_enum_t which; /* which linker section this is */
691 boolean written_address_p; /* whether address was written yet */
692} elf_linker_section_pointers_t;
693
694/* Some private data is stashed away for future use using the tdata pointer
695 in the bfd structure. */
696
697struct elf_obj_tdata
698{
699 Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */
700 Elf_Internal_Shdr **elf_sect_ptr;
701 Elf_Internal_Phdr *phdr;
702 struct elf_segment_map *segment_map;
703 struct bfd_strtab_hash *strtab_ptr;
704 int num_locals;
705 int num_globals;
706 asymbol **section_syms; /* STT_SECTION symbols for each section */
707 Elf_Internal_Shdr symtab_hdr;
708 Elf_Internal_Shdr shstrtab_hdr;
709 Elf_Internal_Shdr strtab_hdr;
710 Elf_Internal_Shdr dynsymtab_hdr;
711 Elf_Internal_Shdr dynstrtab_hdr;
712 Elf_Internal_Shdr dynversym_hdr;
713 Elf_Internal_Shdr dynverref_hdr;
714 Elf_Internal_Shdr dynverdef_hdr;
715 unsigned int symtab_section, shstrtab_section;
716 unsigned int strtab_section, dynsymtab_section;
717 unsigned int dynversym_section, dynverdef_section, dynverref_section;
718 file_ptr next_file_pos;
719#if 0
720 /* we don't need these inside bfd anymore, and I think
721 these weren't used outside bfd. */
722 void *prstatus; /* The raw /proc prstatus structure */
723 void *prpsinfo; /* The raw /proc prpsinfo structure */
724#endif
725 bfd_vma gp; /* The gp value (MIPS only, for now) */
726 unsigned int gp_size; /* The gp size (MIPS only, for now) */
727
728 /* Information grabbed from an elf core file. */
729 int core_signal;
730 int core_pid;
731 int core_lwpid;
732 char* core_program;
733 char* core_command;
734
735 /* This is set to true if the object was created by the backend
736 linker. */
737 boolean linker;
738
739 /* A mapping from external symbols to entries in the linker hash
740 table, used when linking. This is indexed by the symbol index
741 minus the sh_info field of the symbol table header. */
742 struct elf_link_hash_entry **sym_hashes;
743
744 /* A mapping from local symbols to offsets into the global offset
745 table, used when linking. This is indexed by the symbol index.
746 Like for the globals, we use a union and two names primarily to
747 document the intent of any particular piece of code. The field
748 should be used as a count until size_dynamic_sections, at which
749 point the contents of the .got is fixed. Afterward, if an entry
750 is -1, then the symbol does not require a global offset table entry. */
751 union
752 {
753 bfd_signed_vma *refcounts;
754 bfd_vma *offsets;
755 } local_got;
756
757 /* A mapping from local symbols to offsets into the various linker
758 sections added. This is index by the symbol index. */
759 elf_linker_section_pointers_t **linker_section_pointers;
760
761 /* The linker ELF emulation code needs to let the backend ELF linker
762 know what filename should be used for a dynamic object if the
763 dynamic object is found using a search. The emulation code then
764 sometimes needs to know what name was actually used. Until the
765 file has been added to the linker symbol table, this field holds
766 the name the linker wants. After it has been added, it holds the
767 name actually used, which will be the DT_SONAME entry if there is
768 one. */
769 const char *dt_name;
770
771 /* Irix 5 often screws up the symbol table, sorting local symbols
772 after global symbols. This flag is set if the symbol table in
773 this BFD appears to be screwed up. If it is, we ignore the
774 sh_info field in the symbol table header, and always read all the
775 symbols. */
776 boolean bad_symtab;
777
778 /* Records the result of `get_program_header_size'. */
779 bfd_size_type program_header_size;
780
781 /* Used by find_nearest_line entry point. */
782 PTR line_info;
783
784 /* Used by MIPS ELF find_nearest_line entry point. The structure
785 could be included directly in this one, but there's no point to
786 wasting the memory just for the infrequently called
787 find_nearest_line. */
788 struct mips_elf_find_line *find_line_info;
789
790 /* A place to stash dwarf1 info for this bfd. */
791 struct dwarf1_debug *dwarf1_find_line_info;
792
793 /* A place to stash dwarf2 info for this bfd. */
794 struct dwarf2_debug *dwarf2_find_line_info;
795
796 /* An array of stub sections indexed by symbol number, used by the
797 MIPS ELF linker. FIXME: We should figure out some way to only
798 include this field for a MIPS ELF target. */
799 asection **local_stubs;
800
801 /* Used to determine if the e_flags field has been initialized */
802 boolean flags_init;
803
804 /* Number of symbol version definitions we are about to emit. */
805 unsigned int cverdefs;
806
807 /* Number of symbol version references we are about to emit. */
808 unsigned int cverrefs;
809
810 /* Symbol version definitions in external objects. */
811 Elf_Internal_Verdef *verdef;
812
813 /* Symbol version references to external objects. */
814 Elf_Internal_Verneed *verref;
815
816 /* Linker sections that we are interested in. */
817 struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
818};
819
820#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
821#define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
822#define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
823#define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
824#define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
825#define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
826#define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
827#define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
828#define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
829#define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
830#define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
831#define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
832#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
833#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
834#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
835#define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
836#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
837#define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
838#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
839#define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
840#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
841#define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
842#define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
843#define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
844\f
845extern void _bfd_elf_swap_verdef_in
846 PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *));
847extern void _bfd_elf_swap_verdef_out
848 PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *));
849extern void _bfd_elf_swap_verdaux_in
850 PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *));
851extern void _bfd_elf_swap_verdaux_out
852 PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *));
853extern void _bfd_elf_swap_verneed_in
854 PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *));
855extern void _bfd_elf_swap_verneed_out
856 PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *));
857extern void _bfd_elf_swap_vernaux_in
858 PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *));
859extern void _bfd_elf_swap_vernaux_out
860 PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *));
861extern void _bfd_elf_swap_versym_in
862 PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *));
863extern void _bfd_elf_swap_versym_out
864 PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *));
865
866extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *));
867extern char *bfd_elf_string_from_elf_section
868 PARAMS ((bfd *, unsigned, unsigned));
869extern char *bfd_elf_get_str_section PARAMS ((bfd *, unsigned));
870
871extern boolean _bfd_elf_print_private_bfd_data PARAMS ((bfd *, PTR));
872extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *,
873 bfd_print_symbol_type));
874#define elf_string_from_elf_strtab(abfd,strindex) \
875 bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex)
876
877#define bfd_elf32_print_symbol bfd_elf_print_symbol
878#define bfd_elf64_print_symbol bfd_elf_print_symbol
879
880extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *));
881
882extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
883 arelent *,
884 asymbol *,
885 PTR,
886 asection *,
887 bfd *,
888 char **));
889extern boolean bfd_elf_mkobject PARAMS ((bfd *));
890extern boolean bfd_elf_mkcorefile PARAMS ((bfd *));
891extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
892extern boolean _bfd_elf_make_section_from_shdr
893 PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name));
894extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
895 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
896extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
897 PARAMS ((bfd *));
898extern boolean _bfd_elf_link_hash_table_init
899 PARAMS ((struct elf_link_hash_table *, bfd *,
900 struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
901 struct bfd_hash_table *,
902 const char *)));
903extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *));
904
905extern boolean _bfd_elf_copy_private_symbol_data
906 PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
907extern boolean _bfd_elf_copy_private_section_data
908 PARAMS ((bfd *, asection *, bfd *, asection *));
909extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *));
910extern boolean _bfd_elf_write_corefile_contents PARAMS ((bfd *));
911extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
912 file_ptr,
913 bfd_size_type));
914extern long _bfd_elf_get_symtab_upper_bound PARAMS ((bfd *));
915extern long _bfd_elf_get_symtab PARAMS ((bfd *, asymbol **));
916extern long _bfd_elf_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
917extern long _bfd_elf_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **));
918extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
919extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
920 arelent **, asymbol **));
921extern long _bfd_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
922extern long _bfd_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **,
923 asymbol **));
924extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *));
925extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *,
926 symbol_info *));
927extern boolean _bfd_elf_is_local_label_name PARAMS ((bfd *, const char *));
928extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *));
929extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
930 unsigned long));
931extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *,
932 asymbol **,
933 bfd_vma, CONST char **,
934 CONST char **,
935 unsigned int *));
936#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
937#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
938extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean));
939extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *));
23bc299b
MM
940extern boolean _bfd_elf_init_reloc_shdr
941 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean));
252b5132
RH
942
943/* If the target doesn't have reloc handling written yet: */
944extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *,
945 Elf_Internal_Rela *));
946
947extern boolean bfd_section_from_shdr PARAMS ((bfd *, unsigned int shindex));
948extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *, int));
949
950extern int _bfd_elf_symbol_from_bfd_symbol PARAMS ((bfd *, asymbol **));
951
952asection *bfd_section_from_elf_index PARAMS ((bfd *, unsigned int));
953boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
954 struct bfd_link_info *));
955struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void));
956boolean
957_bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *,
958 struct elf_link_hash_entry *));
959boolean
960_bfd_elf_compute_section_file_positions PARAMS ((bfd *,
961 struct bfd_link_info *));
962void _bfd_elf_assign_file_positions_for_relocs PARAMS ((bfd *));
963file_ptr _bfd_elf_assign_file_position_for_section PARAMS ((Elf_Internal_Shdr *,
964 file_ptr,
965 boolean));
966
967extern boolean _bfd_elf_validate_reloc PARAMS ((bfd *, arelent *));
968
969boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
970 struct bfd_link_info *));
971boolean _bfd_elf_create_got_section PARAMS ((bfd *,
972 struct bfd_link_info *));
42751cf3
MM
973boolean _bfd_elf_link_adjust_dynindx PARAMS ((struct elf_link_hash_entry *,
974 PTR));
252b5132
RH
975
976elf_linker_section_t *_bfd_elf_create_linker_section
977 PARAMS ((bfd *abfd,
978 struct bfd_link_info *info,
979 enum elf_linker_section_enum,
980 elf_linker_section_t *defaults));
981
982elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
983 PARAMS ((elf_linker_section_pointers_t *linker_pointers,
984 bfd_signed_vma addend,
985 elf_linker_section_enum_t which));
986
987boolean bfd_elf32_create_pointer_linker_section
988 PARAMS ((bfd *abfd,
989 struct bfd_link_info *info,
990 elf_linker_section_t *lsect,
991 struct elf_link_hash_entry *h,
992 const Elf32_Internal_Rela *rel));
993
994bfd_vma bfd_elf32_finish_pointer_linker_section
995 PARAMS ((bfd *output_abfd,
996 bfd *input_bfd,
997 struct bfd_link_info *info,
998 elf_linker_section_t *lsect,
999 struct elf_link_hash_entry *h,
1000 bfd_vma relocation,
1001 const Elf32_Internal_Rela *rel,
1002 int relative_reloc));
1003
1004boolean bfd_elf64_create_pointer_linker_section
1005 PARAMS ((bfd *abfd,
1006 struct bfd_link_info *info,
1007 elf_linker_section_t *lsect,
1008 struct elf_link_hash_entry *h,
1009 const Elf64_Internal_Rela *rel));
1010
1011bfd_vma bfd_elf64_finish_pointer_linker_section
1012 PARAMS ((bfd *output_abfd,
1013 bfd *input_bfd,
1014 struct bfd_link_info *info,
1015 elf_linker_section_t *lsect,
1016 struct elf_link_hash_entry *h,
1017 bfd_vma relocation,
1018 const Elf64_Internal_Rela *rel,
1019 int relative_reloc));
1020
1021boolean _bfd_elf_make_linker_section_rela
1022 PARAMS ((bfd *dynobj,
1023 elf_linker_section_t *lsect,
1024 int alignment));
1025
1026boolean _bfd_elfcore_section_from_phdr
1027 PARAMS ((bfd *, Elf_Internal_Phdr *, int));
1028
1029extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
1030extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
1031extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
1032extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *));
1033extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *,
1034 bfd *));
1035
1036extern boolean bfd_elf32_bfd_link_add_symbols
1037 PARAMS ((bfd *, struct bfd_link_info *));
1038extern boolean bfd_elf32_bfd_final_link
1039 PARAMS ((bfd *, struct bfd_link_info *));
1040
1041extern void bfd_elf32_swap_symbol_in
1042 PARAMS ((bfd *, const Elf32_External_Sym *, Elf_Internal_Sym *));
1043extern void bfd_elf32_swap_symbol_out
1044 PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
1045extern void bfd_elf32_swap_reloc_in
1046 PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *));
1047extern void bfd_elf32_swap_reloc_out
1048 PARAMS ((bfd *, const Elf_Internal_Rel *, Elf32_External_Rel *));
1049extern void bfd_elf32_swap_reloca_in
1050 PARAMS ((bfd *, const Elf32_External_Rela *, Elf_Internal_Rela *));
1051extern void bfd_elf32_swap_reloca_out
1052 PARAMS ((bfd *, const Elf_Internal_Rela *, Elf32_External_Rela *));
1053extern void bfd_elf32_swap_phdr_in
1054 PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *));
1055extern void bfd_elf32_swap_phdr_out
1056 PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *));
1057extern void bfd_elf32_swap_dyn_in
1058 PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
1059extern void bfd_elf32_swap_dyn_out
c7ac6ff8 1060 PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
252b5132
RH
1061extern long bfd_elf32_slurp_symbol_table
1062 PARAMS ((bfd *, asymbol **, boolean));
1063extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *));
1064extern int bfd_elf32_write_out_phdrs
1065 PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
1066extern boolean bfd_elf32_add_dynamic_entry
1067 PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
1068extern boolean bfd_elf32_link_create_dynamic_sections
1069 PARAMS ((bfd *, struct bfd_link_info *));
1070extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs
1071 PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
1072
1073extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *));
1074extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *));
1075extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *));
1076extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *));
1077extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *,
1078 bfd *));
1079extern boolean bfd_elf64_bfd_link_add_symbols
1080 PARAMS ((bfd *, struct bfd_link_info *));
1081extern boolean bfd_elf64_bfd_final_link
1082 PARAMS ((bfd *, struct bfd_link_info *));
1083
1084extern void bfd_elf64_swap_symbol_in
1085 PARAMS ((bfd *, const Elf64_External_Sym *, Elf_Internal_Sym *));
1086extern void bfd_elf64_swap_symbol_out
1087 PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
1088extern void bfd_elf64_swap_reloc_in
1089 PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *));
1090extern void bfd_elf64_swap_reloc_out
1091 PARAMS ((bfd *, const Elf_Internal_Rel *, Elf64_External_Rel *));
1092extern void bfd_elf64_swap_reloca_in
1093 PARAMS ((bfd *, const Elf64_External_Rela *, Elf_Internal_Rela *));
1094extern void bfd_elf64_swap_reloca_out
1095 PARAMS ((bfd *, const Elf_Internal_Rela *, Elf64_External_Rela *));
1096extern void bfd_elf64_swap_phdr_in
1097 PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *));
1098extern void bfd_elf64_swap_phdr_out
1099 PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *));
1100extern void bfd_elf64_swap_dyn_in
1101 PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
1102extern void bfd_elf64_swap_dyn_out
c7ac6ff8 1103 PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
252b5132
RH
1104extern long bfd_elf64_slurp_symbol_table
1105 PARAMS ((bfd *, asymbol **, boolean));
1106extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *));
1107extern int bfd_elf64_write_out_phdrs
1108 PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
1109extern boolean bfd_elf64_add_dynamic_entry
1110 PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
1111extern boolean bfd_elf64_link_create_dynamic_sections
1112 PARAMS ((bfd *, struct bfd_link_info *));
1113extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
1114 PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
1115
1116#define bfd_elf32_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
1117#define bfd_elf64_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
1118
1119extern boolean _bfd_elf_close_and_cleanup PARAMS ((bfd *));
1120extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
1121 PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR,
1122 asection *, bfd *, char **));
1123
1124boolean _bfd_elf32_gc_sections
1125 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1126boolean _bfd_elf32_gc_common_finalize_got_offsets
1127 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1128boolean _bfd_elf32_gc_common_final_link
1129 PARAMS ((bfd *, struct bfd_link_info *));
1130boolean _bfd_elf32_gc_record_vtinherit
1131 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1132boolean _bfd_elf32_gc_record_vtentry
1133 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1134
1135boolean _bfd_elf64_gc_sections
1136 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1137boolean _bfd_elf64_gc_common_finalize_got_offsets
1138 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1139boolean _bfd_elf64_gc_common_final_link
1140 PARAMS ((bfd *, struct bfd_link_info *));
1141boolean _bfd_elf64_gc_record_vtinherit
1142 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1143boolean _bfd_elf64_gc_record_vtentry
1144 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1145
1146/* MIPS ELF specific routines. */
1147
1148extern boolean _bfd_mips_elf_object_p PARAMS ((bfd *));
1149extern boolean _bfd_mips_elf_section_from_shdr
1150 PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
1151extern boolean _bfd_mips_elf_fake_sections
1152 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
1153extern boolean _bfd_mips_elf_section_from_bfd_section
1154 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, int *));
1155extern boolean _bfd_mips_elf_section_processing
1156 PARAMS ((bfd *, Elf_Internal_Shdr *));
1157extern void _bfd_mips_elf_symbol_processing PARAMS ((bfd *, asymbol *));
1158extern boolean _bfd_mips_elf_read_ecoff_info
1159 PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
1160extern void _bfd_mips_elf_final_write_processing PARAMS ((bfd *, boolean));
1161extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
1162 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1163extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
1164 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1165extern bfd_reloc_status_type _bfd_mips_elf_gprel16_reloc
1166 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1167extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
1168 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1169extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc
1170 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1171extern boolean _bfd_mips_elf_set_private_flags PARAMS ((bfd *, flagword));
1172extern boolean _bfd_mips_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *));
1173extern boolean _bfd_mips_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
1174extern boolean _bfd_mips_elf_find_nearest_line
1175 PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
1176 const char **, unsigned int *));
1177extern boolean _bfd_mips_elf_set_section_contents
1178 PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
1179
1180#endif /* _LIBELF_H_ */
This page took 0.074445 seconds and 4 git commands to generate.