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