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