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