Still a lot of bogus code; just a checkpoint.
[deliverable/binutils-gdb.git] / bfd / elf-bfd.h
1 /* BFD back-end data structures for ELF files.
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
3 Written by Cygnus Support.
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, 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
51 typedef 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;
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
71 } elf_symbol_type;
72 \f
73 /* ELF linker hash table entries. */
74
75 struct 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
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;
117
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
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
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
144 /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
145 char type;
146
147 /* Symbol st_other value. */
148 unsigned char other;
149
150 /* Hash value of the name computed using the ELF hash function. */
151 unsigned long elf_hash_value;
152
153 /* Some flags; legal values follow. */
154 unsigned short elf_link_hash_flags;
155 /* Symbol is referenced by a non-shared object. */
156 #define ELF_LINK_HASH_REF_REGULAR 01
157 /* Symbol is defined by a non-shared object. */
158 #define ELF_LINK_HASH_DEF_REGULAR 02
159 /* Symbol is referenced by a shared object. */
160 #define ELF_LINK_HASH_REF_DYNAMIC 04
161 /* Symbol is defined by a shared object. */
162 #define ELF_LINK_HASH_DEF_DYNAMIC 010
163 /* Dynamic symbol has been adjustd. */
164 #define ELF_LINK_HASH_DYNAMIC_ADJUSTED 020
165 /* Symbol needs a copy reloc. */
166 #define ELF_LINK_HASH_NEEDS_COPY 040
167 /* Symbol needs a procedure linkage table entry. */
168 #define ELF_LINK_HASH_NEEDS_PLT 0100
169 /* Symbol appears in a non-ELF input file. */
170 #define ELF_LINK_NON_ELF 0200
171 /* Symbol should be marked as hidden in the version information. */
172 #define ELF_LINK_HIDDEN 0400
173 /* Symbol was forced to local scope due to a version script file. */
174 #define ELF_LINK_FORCED_LOCAL 01000
175 /* Symbol was marked during garbage collection. */
176 #define ELF_LINK_HASH_MARK 02000
177 };
178
179 /* ELF linker hash table. */
180
181 struct elf_link_hash_table
182 {
183 struct bfd_link_hash_table root;
184 /* Whether we have created the special dynamic sections required
185 when linking against or generating a shared object. */
186 boolean dynamic_sections_created;
187 /* The BFD used to hold special sections created by the linker.
188 This will be the first BFD found which requires these sections to
189 be created. */
190 bfd *dynobj;
191 /* The number of symbols found in the link which must be put into
192 the .dynsym section. */
193 bfd_size_type dynsymcount;
194 /* The string table of dynamic symbols, which becomes the .dynstr
195 section. */
196 struct bfd_strtab_hash *dynstr;
197 /* The number of buckets in the hash table in the .hash section.
198 This is based on the number of dynamic symbols. */
199 bfd_size_type bucketcount;
200 /* A linked list of DT_NEEDED names found in dynamic objects
201 included in the link. */
202 struct bfd_link_needed_list *needed;
203 /* The _GLOBAL_OFFSET_TABLE_ symbol. */
204 struct elf_link_hash_entry *hgot;
205 /* A pointer to information used to link stabs in sections. */
206 PTR stab_info;
207 };
208
209 /* Look up an entry in an ELF linker hash table. */
210
211 #define elf_link_hash_lookup(table, string, create, copy, follow) \
212 ((struct elf_link_hash_entry *) \
213 bfd_link_hash_lookup (&(table)->root, (string), (create), \
214 (copy), (follow)))
215
216 /* Traverse an ELF linker hash table. */
217
218 #define elf_link_hash_traverse(table, func, info) \
219 (bfd_link_hash_traverse \
220 (&(table)->root, \
221 (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
222 (info)))
223
224 /* Get the ELF linker hash table from a link_info structure. */
225
226 #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
227 \f
228 /* Constant information held for an ELF backend. */
229
230 struct elf_size_info {
231 unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
232 unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
233
234 unsigned char arch_size, file_align;
235 unsigned char elfclass, ev_current;
236 int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
237 boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *));
238 void (*write_relocs) PARAMS ((bfd *, asection *, PTR));
239 void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
240 boolean (*slurp_reloc_table)
241 PARAMS ((bfd *, asection *, asymbol **, boolean));
242 long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean));
243 void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
244 };
245
246 #define elf_symbol_from(ABFD,S) \
247 (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
248 && (S)->the_bfd->tdata.elf_obj_data != 0) \
249 ? (elf_symbol_type *) (S) \
250 : 0)
251
252 struct elf_backend_data
253 {
254 /* Whether the backend uses REL or RELA relocations. FIXME: some
255 ELF backends use both. When we need to support one, this whole
256 approach will need to be changed. */
257 int use_rela_p;
258
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
514 /* The swapping table to use when dealing with ECOFF information.
515 Used for the MIPS ELF .mdebug section. */
516 const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
517
518 /* Alternate EM_xxxx machine codes for this backend. */
519 int elf_machine_alt1;
520 int elf_machine_alt2;
521
522 const struct elf_size_info *s;
523
524 /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
525 .got section */
526 bfd_vma got_symbol_offset;
527
528 /* The size in bytes of the headers for the GOT and PLT. This includes
529 the so-called reserved entries on some systems. */
530 bfd_vma got_header_size;
531 bfd_vma plt_header_size;
532
533 unsigned want_got_plt : 1;
534 unsigned plt_readonly : 1;
535 unsigned want_plt_sym : 1;
536 unsigned plt_not_loaded : 1;
537 unsigned plt_alignment : 4;
538 unsigned can_gc_sections : 1;
539 };
540
541 /* Information stored for each BFD section in an ELF file. This
542 structure is allocated by elf_new_section_hook. */
543
544 struct bfd_elf_section_data
545 {
546 /* The ELF header for this section. */
547 Elf_Internal_Shdr this_hdr;
548 /* The ELF header for the reloc section associated with this
549 section, if any. */
550 Elf_Internal_Shdr rel_hdr;
551 /* If there is a second reloc section associated with this section,
552 as can happen on Irix 6, this field points to the header. */
553 Elf_Internal_Shdr *rel_hdr2;
554 /* The ELF section number of this section. Only used for an output
555 file. */
556 int this_idx;
557 /* The ELF section number of the reloc section associated with this
558 section, if any. Only used for an output file. */
559 int rel_idx;
560 /* Used by the backend linker to store the symbol hash table entries
561 associated with relocs against global symbols. */
562 struct elf_link_hash_entry **rel_hashes;
563 /* A pointer to the swapped relocs. If the section uses REL relocs,
564 rather than RELA, all the r_addend fields will be zero. This
565 pointer may be NULL. It is used by the backend linker. */
566 Elf_Internal_Rela *relocs;
567 /* Used by the backend linker when generating a shared library to
568 record the dynamic symbol index for a section symbol
569 corresponding to this section. */
570 long dynindx;
571 /* A pointer used for .stab linking optimizations. */
572 PTR stab_info;
573 /* A pointer available for the processor specific ELF backend. */
574 PTR tdata;
575 };
576
577 #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
578
579 #define get_elf_backend_data(abfd) \
580 ((struct elf_backend_data *) (abfd)->xvec->backend_data)
581
582 /* Enumeration to specify the special section. */
583 typedef enum elf_linker_section_enum
584 {
585 LINKER_SECTION_UNKNOWN, /* not used */
586 LINKER_SECTION_GOT, /* .got section for global offset pointers */
587 LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */
588 LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */
589 LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */
590 LINKER_SECTION_MAX /* # of linker sections */
591 } elf_linker_section_enum_t;
592
593 /* Sections created by the linker. */
594
595 typedef struct elf_linker_section
596 {
597 char *name; /* name of the section */
598 char *rel_name; /* name of the associated .rel{,a}. section */
599 char *bss_name; /* name of a related .bss section */
600 char *sym_name; /* name of symbol to reference this section */
601 asection *section; /* pointer to the section */
602 asection *bss_section; /* pointer to the bss section associated with this */
603 asection *rel_section; /* pointer to the relocations needed for this section */
604 struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */
605 bfd_vma initial_size; /* initial size before any linker generated allocations */
606 bfd_vma sym_offset; /* offset of symbol from beginning of section */
607 bfd_vma hole_size; /* size of reserved address hole in allocation */
608 bfd_vma hole_offset; /* current offset for the hole */
609 bfd_vma max_hole_offset; /* maximum offset for the hole */
610 elf_linker_section_enum_t which; /* which section this is */
611 boolean hole_written_p; /* whether the hole has been initialized */
612 unsigned int alignment; /* alignment for the section */
613 flagword flags; /* flags to use to create the section */
614 } elf_linker_section_t;
615
616 /* Linked list of allocated pointer entries. This hangs off of the symbol lists, and
617 provides allows us to return different pointers, based on different addend's. */
618
619 typedef struct elf_linker_section_pointers
620 {
621 struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */
622 bfd_vma offset; /* offset of pointer from beginning of section */
623 bfd_signed_vma addend; /* addend used */
624 elf_linker_section_enum_t which; /* which linker section this is */
625 boolean written_address_p; /* whether address was written yet */
626 } elf_linker_section_pointers_t;
627
628 /* Some private data is stashed away for future use using the tdata pointer
629 in the bfd structure. */
630
631 struct elf_obj_tdata
632 {
633 Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */
634 Elf_Internal_Shdr **elf_sect_ptr;
635 Elf_Internal_Phdr *phdr;
636 struct elf_segment_map *segment_map;
637 struct bfd_strtab_hash *strtab_ptr;
638 int num_locals;
639 int num_globals;
640 asymbol **section_syms; /* STT_SECTION symbols for each section */
641 Elf_Internal_Shdr symtab_hdr;
642 Elf_Internal_Shdr shstrtab_hdr;
643 Elf_Internal_Shdr strtab_hdr;
644 Elf_Internal_Shdr dynsymtab_hdr;
645 Elf_Internal_Shdr dynstrtab_hdr;
646 Elf_Internal_Shdr dynversym_hdr;
647 Elf_Internal_Shdr dynverref_hdr;
648 Elf_Internal_Shdr dynverdef_hdr;
649 unsigned int symtab_section, shstrtab_section;
650 unsigned int strtab_section, dynsymtab_section;
651 unsigned int dynversym_section, dynverdef_section, dynverref_section;
652 file_ptr next_file_pos;
653 #if 0
654 /* we don't need these inside bfd anymore, and I think
655 these weren't used outside bfd. */
656 void *prstatus; /* The raw /proc prstatus structure */
657 void *prpsinfo; /* The raw /proc prpsinfo structure */
658 #endif
659 bfd_vma gp; /* The gp value (MIPS only, for now) */
660 unsigned int gp_size; /* The gp size (MIPS only, for now) */
661
662 /* Information grabbed from an elf core file. */
663 int core_signal;
664 int core_pid;
665 int core_lwpid;
666 char* core_program;
667 char* core_command;
668
669 /* This is set to true if the object was created by the backend
670 linker. */
671 boolean linker;
672
673 /* A mapping from external symbols to entries in the linker hash
674 table, used when linking. This is indexed by the symbol index
675 minus the sh_info field of the symbol table header. */
676 struct elf_link_hash_entry **sym_hashes;
677
678 /* A mapping from local symbols to offsets into the global offset
679 table, used when linking. This is indexed by the symbol index.
680 Like for the globals, we use a union and two names primarily to
681 document the intent of any particular piece of code. The field
682 should be used as a count until size_dynamic_sections, at which
683 point the contents of the .got is fixed. Afterward, if an entry
684 is -1, then the symbol does not require a global offset table entry. */
685 union
686 {
687 bfd_signed_vma *refcounts;
688 bfd_vma *offsets;
689 } local_got;
690
691 /* A mapping from local symbols to offsets into the various linker
692 sections added. This is index by the symbol index. */
693 elf_linker_section_pointers_t **linker_section_pointers;
694
695 /* The linker ELF emulation code needs to let the backend ELF linker
696 know what filename should be used for a dynamic object if the
697 dynamic object is found using a search. The emulation code then
698 sometimes needs to know what name was actually used. Until the
699 file has been added to the linker symbol table, this field holds
700 the name the linker wants. After it has been added, it holds the
701 name actually used, which will be the DT_SONAME entry if there is
702 one. */
703 const char *dt_name;
704
705 /* Irix 5 often screws up the symbol table, sorting local symbols
706 after global symbols. This flag is set if the symbol table in
707 this BFD appears to be screwed up. If it is, we ignore the
708 sh_info field in the symbol table header, and always read all the
709 symbols. */
710 boolean bad_symtab;
711
712 /* Records the result of `get_program_header_size'. */
713 bfd_size_type program_header_size;
714
715 /* Used by find_nearest_line entry point. */
716 PTR line_info;
717
718 /* Used by MIPS ELF find_nearest_line entry point. The structure
719 could be included directly in this one, but there's no point to
720 wasting the memory just for the infrequently called
721 find_nearest_line. */
722 struct mips_elf_find_line *find_line_info;
723
724 /* A place to stash dwarf1 info for this bfd. */
725 struct dwarf1_debug *dwarf1_find_line_info;
726
727 /* A place to stash dwarf2 info for this bfd. */
728 struct dwarf2_debug *dwarf2_find_line_info;
729
730 /* An array of stub sections indexed by symbol number, used by the
731 MIPS ELF linker. FIXME: We should figure out some way to only
732 include this field for a MIPS ELF target. */
733 asection **local_stubs;
734
735 /* Used to determine if the e_flags field has been initialized */
736 boolean flags_init;
737
738 /* Number of symbol version definitions we are about to emit. */
739 unsigned int cverdefs;
740
741 /* Number of symbol version references we are about to emit. */
742 unsigned int cverrefs;
743
744 /* Symbol version definitions in external objects. */
745 Elf_Internal_Verdef *verdef;
746
747 /* Symbol version references to external objects. */
748 Elf_Internal_Verneed *verref;
749
750 /* Linker sections that we are interested in. */
751 struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
752 };
753
754 #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
755 #define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
756 #define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
757 #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
758 #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
759 #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
760 #define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
761 #define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
762 #define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
763 #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
764 #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
765 #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
766 #define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
767 #define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
768 #define elf_gp(bfd) (elf_tdata(bfd) -> gp)
769 #define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
770 #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
771 #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
772 #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
773 #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
774 #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
775 #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
776 #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
777 #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
778 \f
779 extern void _bfd_elf_swap_verdef_in
780 PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *));
781 extern void _bfd_elf_swap_verdef_out
782 PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *));
783 extern void _bfd_elf_swap_verdaux_in
784 PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *));
785 extern void _bfd_elf_swap_verdaux_out
786 PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *));
787 extern void _bfd_elf_swap_verneed_in
788 PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *));
789 extern void _bfd_elf_swap_verneed_out
790 PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *));
791 extern void _bfd_elf_swap_vernaux_in
792 PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *));
793 extern void _bfd_elf_swap_vernaux_out
794 PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *));
795 extern void _bfd_elf_swap_versym_in
796 PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *));
797 extern void _bfd_elf_swap_versym_out
798 PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *));
799
800 extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *));
801 extern char *bfd_elf_string_from_elf_section
802 PARAMS ((bfd *, unsigned, unsigned));
803 extern char *bfd_elf_get_str_section PARAMS ((bfd *, unsigned));
804
805 extern boolean _bfd_elf_print_private_bfd_data PARAMS ((bfd *, PTR));
806 extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *,
807 bfd_print_symbol_type));
808 #define elf_string_from_elf_strtab(abfd,strindex) \
809 bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex)
810
811 #define bfd_elf32_print_symbol bfd_elf_print_symbol
812 #define bfd_elf64_print_symbol bfd_elf_print_symbol
813
814 extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *));
815
816 extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
817 arelent *,
818 asymbol *,
819 PTR,
820 asection *,
821 bfd *,
822 char **));
823 extern boolean bfd_elf_mkobject PARAMS ((bfd *));
824 extern boolean bfd_elf_mkcorefile PARAMS ((bfd *));
825 extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
826 extern boolean _bfd_elf_make_section_from_shdr
827 PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name));
828 extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
829 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
830 extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
831 PARAMS ((bfd *));
832 extern boolean _bfd_elf_link_hash_table_init
833 PARAMS ((struct elf_link_hash_table *, bfd *,
834 struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
835 struct bfd_hash_table *,
836 const char *)));
837 extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *));
838
839 extern boolean _bfd_elf_copy_private_symbol_data
840 PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
841 extern boolean _bfd_elf_copy_private_section_data
842 PARAMS ((bfd *, asection *, bfd *, asection *));
843 extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *));
844 extern boolean _bfd_elf_write_corefile_contents PARAMS ((bfd *));
845 extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
846 file_ptr,
847 bfd_size_type));
848 extern long _bfd_elf_get_symtab_upper_bound PARAMS ((bfd *));
849 extern long _bfd_elf_get_symtab PARAMS ((bfd *, asymbol **));
850 extern long _bfd_elf_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
851 extern long _bfd_elf_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **));
852 extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
853 extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
854 arelent **, asymbol **));
855 extern long _bfd_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
856 extern long _bfd_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **,
857 asymbol **));
858 extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *));
859 extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *,
860 symbol_info *));
861 extern boolean _bfd_elf_is_local_label_name PARAMS ((bfd *, const char *));
862 extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *));
863 extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
864 unsigned long));
865 extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *,
866 asymbol **,
867 bfd_vma, CONST char **,
868 CONST char **,
869 unsigned int *));
870 #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
871 #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
872 extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean));
873 extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *));
874
875 /* If the target doesn't have reloc handling written yet: */
876 extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *,
877 Elf_Internal_Rela *));
878
879 extern boolean bfd_section_from_shdr PARAMS ((bfd *, unsigned int shindex));
880 extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *, int));
881
882 extern int _bfd_elf_symbol_from_bfd_symbol PARAMS ((bfd *, asymbol **));
883
884 asection *bfd_section_from_elf_index PARAMS ((bfd *, unsigned int));
885 boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
886 struct bfd_link_info *));
887 struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void));
888 boolean
889 _bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *,
890 struct elf_link_hash_entry *));
891 boolean
892 _bfd_elf_compute_section_file_positions PARAMS ((bfd *,
893 struct bfd_link_info *));
894 void _bfd_elf_assign_file_positions_for_relocs PARAMS ((bfd *));
895 file_ptr _bfd_elf_assign_file_position_for_section PARAMS ((Elf_Internal_Shdr *,
896 file_ptr,
897 boolean));
898
899 extern boolean _bfd_elf_validate_reloc PARAMS ((bfd *, arelent *));
900
901 boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
902 struct bfd_link_info *));
903 boolean _bfd_elf_create_got_section PARAMS ((bfd *,
904 struct bfd_link_info *));
905
906 elf_linker_section_t *_bfd_elf_create_linker_section
907 PARAMS ((bfd *abfd,
908 struct bfd_link_info *info,
909 enum elf_linker_section_enum,
910 elf_linker_section_t *defaults));
911
912 elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
913 PARAMS ((elf_linker_section_pointers_t *linker_pointers,
914 bfd_signed_vma addend,
915 elf_linker_section_enum_t which));
916
917 boolean bfd_elf32_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 Elf32_Internal_Rela *rel));
923
924 bfd_vma bfd_elf32_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 Elf32_Internal_Rela *rel,
932 int relative_reloc));
933
934 boolean bfd_elf64_create_pointer_linker_section
935 PARAMS ((bfd *abfd,
936 struct bfd_link_info *info,
937 elf_linker_section_t *lsect,
938 struct elf_link_hash_entry *h,
939 const Elf64_Internal_Rela *rel));
940
941 bfd_vma bfd_elf64_finish_pointer_linker_section
942 PARAMS ((bfd *output_abfd,
943 bfd *input_bfd,
944 struct bfd_link_info *info,
945 elf_linker_section_t *lsect,
946 struct elf_link_hash_entry *h,
947 bfd_vma relocation,
948 const Elf64_Internal_Rela *rel,
949 int relative_reloc));
950
951 boolean _bfd_elf_make_linker_section_rela
952 PARAMS ((bfd *dynobj,
953 elf_linker_section_t *lsect,
954 int alignment));
955
956 extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
957 extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
958 extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
959 extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *));
960 extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *,
961 bfd *));
962
963 extern boolean bfd_elf32_bfd_link_add_symbols
964 PARAMS ((bfd *, struct bfd_link_info *));
965 extern boolean bfd_elf32_bfd_final_link
966 PARAMS ((bfd *, struct bfd_link_info *));
967
968 extern void bfd_elf32_swap_symbol_in
969 PARAMS ((bfd *, const Elf32_External_Sym *, Elf_Internal_Sym *));
970 extern void bfd_elf32_swap_symbol_out
971 PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
972 extern void bfd_elf32_swap_reloc_in
973 PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *));
974 extern void bfd_elf32_swap_reloc_out
975 PARAMS ((bfd *, const Elf_Internal_Rel *, Elf32_External_Rel *));
976 extern void bfd_elf32_swap_reloca_in
977 PARAMS ((bfd *, const Elf32_External_Rela *, Elf_Internal_Rela *));
978 extern void bfd_elf32_swap_reloca_out
979 PARAMS ((bfd *, const Elf_Internal_Rela *, Elf32_External_Rela *));
980 extern void bfd_elf32_swap_phdr_in
981 PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *));
982 extern void bfd_elf32_swap_phdr_out
983 PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *));
984 extern void bfd_elf32_swap_dyn_in
985 PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
986 extern void bfd_elf32_swap_dyn_out
987 PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf32_External_Dyn *));
988 extern long bfd_elf32_slurp_symbol_table
989 PARAMS ((bfd *, asymbol **, boolean));
990 extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *));
991 extern int bfd_elf32_write_out_phdrs
992 PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
993 extern boolean bfd_elf32_add_dynamic_entry
994 PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
995 extern boolean bfd_elf32_link_create_dynamic_sections
996 PARAMS ((bfd *, struct bfd_link_info *));
997 extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs
998 PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
999
1000 extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *));
1001 extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *));
1002 extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *));
1003 extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *));
1004 extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *,
1005 bfd *));
1006 extern boolean bfd_elf64_bfd_link_add_symbols
1007 PARAMS ((bfd *, struct bfd_link_info *));
1008 extern boolean bfd_elf64_bfd_final_link
1009 PARAMS ((bfd *, struct bfd_link_info *));
1010
1011 extern void bfd_elf64_swap_symbol_in
1012 PARAMS ((bfd *, const Elf64_External_Sym *, Elf_Internal_Sym *));
1013 extern void bfd_elf64_swap_symbol_out
1014 PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
1015 extern void bfd_elf64_swap_reloc_in
1016 PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *));
1017 extern void bfd_elf64_swap_reloc_out
1018 PARAMS ((bfd *, const Elf_Internal_Rel *, Elf64_External_Rel *));
1019 extern void bfd_elf64_swap_reloca_in
1020 PARAMS ((bfd *, const Elf64_External_Rela *, Elf_Internal_Rela *));
1021 extern void bfd_elf64_swap_reloca_out
1022 PARAMS ((bfd *, const Elf_Internal_Rela *, Elf64_External_Rela *));
1023 extern void bfd_elf64_swap_phdr_in
1024 PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *));
1025 extern void bfd_elf64_swap_phdr_out
1026 PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *));
1027 extern void bfd_elf64_swap_dyn_in
1028 PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
1029 extern void bfd_elf64_swap_dyn_out
1030 PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf64_External_Dyn *));
1031 extern long bfd_elf64_slurp_symbol_table
1032 PARAMS ((bfd *, asymbol **, boolean));
1033 extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *));
1034 extern int bfd_elf64_write_out_phdrs
1035 PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
1036 extern boolean bfd_elf64_add_dynamic_entry
1037 PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
1038 extern boolean bfd_elf64_link_create_dynamic_sections
1039 PARAMS ((bfd *, struct bfd_link_info *));
1040 extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
1041 PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
1042
1043 #define bfd_elf32_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
1044 #define bfd_elf64_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
1045
1046 extern boolean _bfd_elf_close_and_cleanup PARAMS ((bfd *));
1047 extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
1048 PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR,
1049 asection *, bfd *, char **));
1050
1051 boolean _bfd_elf32_gc_sections
1052 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1053 boolean _bfd_elf32_gc_common_finalize_got_offsets
1054 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1055 boolean _bfd_elf32_gc_common_final_link
1056 PARAMS ((bfd *, struct bfd_link_info *));
1057 boolean _bfd_elf32_gc_record_vtinherit
1058 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1059 boolean _bfd_elf32_gc_record_vtentry
1060 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1061
1062 boolean _bfd_elf64_gc_sections
1063 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1064 boolean _bfd_elf64_gc_common_finalize_got_offsets
1065 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1066 boolean _bfd_elf64_gc_common_final_link
1067 PARAMS ((bfd *, struct bfd_link_info *));
1068 boolean _bfd_elf64_gc_record_vtinherit
1069 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1070 boolean _bfd_elf64_gc_record_vtentry
1071 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1072
1073 /* MIPS ELF specific routines. */
1074
1075 extern boolean _bfd_mips_elf_object_p PARAMS ((bfd *));
1076 extern boolean _bfd_mips_elf_section_from_shdr
1077 PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
1078 extern boolean _bfd_mips_elf_fake_sections
1079 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
1080 extern boolean _bfd_mips_elf_section_from_bfd_section
1081 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, int *));
1082 extern boolean _bfd_mips_elf_section_processing
1083 PARAMS ((bfd *, Elf_Internal_Shdr *));
1084 extern void _bfd_mips_elf_symbol_processing PARAMS ((bfd *, asymbol *));
1085 extern boolean _bfd_mips_elf_read_ecoff_info
1086 PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
1087 extern void _bfd_mips_elf_final_write_processing PARAMS ((bfd *, boolean));
1088 extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
1089 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1090 extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
1091 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1092 extern bfd_reloc_status_type _bfd_mips_elf_gprel16_reloc
1093 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1094 extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
1095 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1096 extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc
1097 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1098 extern boolean _bfd_mips_elf_set_private_flags PARAMS ((bfd *, flagword));
1099 extern boolean _bfd_mips_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *));
1100 extern boolean _bfd_mips_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
1101 extern boolean _bfd_mips_elf_find_nearest_line
1102 PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
1103 const char **, unsigned int *));
1104 extern boolean _bfd_mips_elf_set_section_contents
1105 PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
1106
1107 #endif /* _LIBELF_H_ */
This page took 0.055009 seconds and 4 git commands to generate.