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