home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / GDB / GDB-4.13 / GDB-4 / gdb-4.13 / bfd / libelf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-16  |  25.8 KB  |  634 lines

  1. /* BFD back-end data structures for ELF files.
  2.    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  3.    Written by Cygnus Support.
  4.  
  5. This file is part of BFD, the Binary File Descriptor library.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #ifndef _LIBELF_H_
  22. #define _LIBELF_H_ 1
  23.  
  24. #include "elf/common.h"
  25. #include "elf/internal.h"
  26. #include "elf/external.h"
  27. #include "bfdlink.h"
  28.  
  29. /* If size isn't specified as 64 or 32, NAME macro should fail.  */
  30. #ifndef NAME
  31. #if ARCH_SIZE==64
  32. #define NAME(x,y) CAT4(x,64,_,y)
  33. #endif
  34. #if ARCH_SIZE==32
  35. #define NAME(x,y) CAT4(x,32,_,y)
  36. #endif
  37. #endif
  38.  
  39. #ifndef NAME
  40. #define NAME(x,y) CAT4(x,NOSIZE,_,y)
  41. #endif
  42.  
  43. #define ElfNAME(X)    NAME(Elf,X)
  44. #define elfNAME(X)    NAME(elf,X)
  45.  
  46. /* Information held for an ELF symbol.  The first field is the
  47.    corresponding asymbol.  Every symbol is an ELF file is actually a
  48.    pointer to this structure, although it is often handled as a
  49.    pointer to an asymbol.  */
  50.  
  51. typedef struct
  52. {
  53.   /* The BFD symbol.  */
  54.   asymbol symbol;
  55.   /* ELF symbol information.  */
  56.   Elf_Internal_Sym internal_elf_sym;
  57.   /* Backend specific information.  */
  58.   union
  59.     {
  60.       unsigned int hppa_arg_reloc;
  61.       PTR mips_extr;
  62.       PTR any;
  63.     }
  64.   tc_data;
  65. } elf_symbol_type;
  66.  
  67. /* ELF linker hash table entries.  */
  68.  
  69. struct elf_link_hash_entry
  70. {
  71.   struct bfd_link_hash_entry root;
  72.  
  73.   /* Symbol index in output file.  This is initialized to -1.  It is
  74.      set to -2 if the symbol is used by a reloc.  */
  75.   long indx;
  76.  
  77.   /* Symbol size.  */
  78.   bfd_size_type size;
  79.  
  80.   /* Symbol alignment (common symbols only).  */
  81.   bfd_size_type align;
  82.  
  83.   /* Symbol index as a dynamic symbol.  Initialized to -1, and remains
  84.      -1 if this is not a dynamic symbol.  */
  85.   long dynindx;
  86.  
  87.   /* String table index in .dynstr if this is a dynamic symbol.  */
  88.   unsigned long dynstr_index;
  89.  
  90.   /* If this is a weak defined symbol from a dynamic object, this
  91.      field points to a defined symbol with the same value, if there is
  92.      one.  Otherwise it is NULL.  */
  93.   struct elf_link_hash_entry *weakdef;
  94.  
  95.   /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.).  */
  96.   char type;
  97.  
  98.   /* Some flags; legal values follow.  */
  99.   unsigned char elf_link_hash_flags;
  100.   /* Symbol is referenced by a non-shared object.  */
  101. #define ELF_LINK_HASH_REF_REGULAR 01
  102.   /* Symbol is defined by a non-shared object.  */
  103. #define ELF_LINK_HASH_DEF_REGULAR 02
  104.   /* Symbol is referenced by a shared object.  */
  105. #define ELF_LINK_HASH_REF_DYNAMIC 04
  106.   /* Symbol is defined by a shared object.  */
  107. #define ELF_LINK_HASH_DEF_DYNAMIC 010
  108.   /* Symbol is referenced by two or more shared objects.  */
  109. #define ELF_LINK_HASH_REF_DYNAMIC_MULTIPLE 020
  110.   /* Symbol is defined by two or more shared objects.  */
  111. #define ELF_LINK_HASH_DEF_DYNAMIC_MULTIPLE 040
  112.   /* Dynamic symbol has been adjustd.  */
  113. #define ELF_LINK_HASH_DYNAMIC_ADJUSTED 0100
  114.   /* Symbol is defined as weak.  */
  115. #define ELF_LINK_HASH_DEFINED_WEAK 0200
  116. };
  117.  
  118. /* ELF linker hash table.  */
  119.  
  120. struct elf_link_hash_table
  121. {
  122.   struct bfd_link_hash_table root;
  123.   /* The first dynamic object found during a link.  We create several
  124.      special input sections when linking against dynamic objects, and
  125.      we simply attach them to the first one found.  */
  126.   bfd *dynobj;
  127.   /* The number of symbols found in the link which must be put into
  128.      the .dynsym section.  */
  129.   size_t dynsymcount;
  130.   /* The string table of dynamic symbols, which becomes the .dynstr
  131.      section.  */
  132.   struct strtab *dynstr;
  133.   /* The number of buckets in the hash table in the .hash section.
  134.      This is based on the number of dynamic symbols.  */
  135.   size_t bucketcount;
  136. };
  137.  
  138. /* Look up an entry in an ELF linker hash table.  */
  139.  
  140. #define elf_link_hash_lookup(table, string, create, copy, follow)    \
  141.   ((struct elf_link_hash_entry *)                    \
  142.    bfd_link_hash_lookup (&(table)->root, (string), (create),        \
  143.              (copy), (follow)))
  144.  
  145. /* Traverse an ELF linker hash table.  */
  146.  
  147. #define elf_link_hash_traverse(table, func, info)            \
  148.   (bfd_link_hash_traverse                        \
  149.    (&(table)->root,                            \
  150.     (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),    \
  151.     (info)))
  152.  
  153. /* Get the ELF linker hash table from a link_info structure.  */
  154.  
  155. #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
  156.  
  157. /* Constant information held for an ELF backend.  */
  158.  
  159. struct elf_backend_data
  160. {
  161.   /* Whether the backend uses REL or RELA relocations.  FIXME: some
  162.      ELF backends use both.  When we need to support one, this whole
  163.      approach will need to be changed.  */
  164.   int use_rela_p;
  165.  
  166.   /* Whether this backend is 64 bits or not.  FIXME: Who cares?  */
  167.   int elf_64_p;
  168.  
  169.   /* The architecture for this backend.  */
  170.   enum bfd_architecture arch;
  171.  
  172.   /* The ELF machine code (EM_xxxx) for this backend.  */
  173.   int elf_machine_code;
  174.  
  175.   /* The maximum page size for this backend.  */
  176.   bfd_vma maxpagesize;
  177.  
  178.   /* This is true if the linker should act like collect and gather
  179.      global constructors and destructors by name.  This is true for
  180.      MIPS ELF because the Irix 5 tools can not handle the .init
  181.      section.  */
  182.   boolean collect;
  183.  
  184.   /* A function to translate an ELF RELA relocation to a BFD arelent
  185.      structure.  */
  186.   void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
  187.                      Elf_Internal_Rela *));
  188.  
  189.   /* A function to translate an ELF REL relocation to a BFD arelent
  190.      structure.  */
  191.   void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *,
  192.                      Elf_Internal_Rel *));
  193.  
  194.   /* A function to determine whether a symbol is global when
  195.      partitioning the symbol table into local and global symbols.
  196.      This should be NULL for most targets, in which case the correct
  197.      thing will be done.  MIPS ELF, at least on the Irix 5, has
  198.      special requirements.  */
  199.   boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *));
  200.  
  201.   /* The remaining functions are hooks which are called only if they
  202.      are not NULL.  */
  203.  
  204.   /* A function to permit a backend specific check on whether a
  205.      particular BFD format is relevant for an object file, and to
  206.      permit the backend to set any global information it wishes.  When
  207.      this is called elf_elfheader is set, but anything else should be
  208.      used with caution.  If this returns false, the check_format
  209.      routine will return a bfd_error_wrong_format error.  */
  210.   boolean (*elf_backend_object_p) PARAMS ((bfd *));
  211.  
  212.   /* A function to do additional symbol processing when reading the
  213.      ELF symbol table.  This is where any processor-specific special
  214.      section indices are handled.  */
  215.   void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *));
  216.  
  217.   /* A function to do additional symbol processing after reading the
  218.      entire ELF symbol table.  */
  219.   boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *,
  220.                               elf_symbol_type *,
  221.                               int));
  222.  
  223.   /* A function to do additional processing on the ELF section header
  224.      just before writing it out.  This is used to set the flags and
  225.      type fields for some sections, or to actually write out data for
  226.      unusual sections.  */
  227.   boolean (*elf_backend_section_processing) PARAMS ((bfd *,
  228.                              Elf32_Internal_Shdr *));
  229.  
  230.   /* A function to handle unusual section types when creating BFD
  231.      sections from ELF sections.  */
  232.   boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *,
  233.                             Elf32_Internal_Shdr *,
  234.                             char *));
  235.  
  236.   /* A function to set up the ELF section header for a BFD section in
  237.      preparation for writing it out.  This is where the flags and type
  238.      fields are set for unusual sections.  */
  239.   boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *,
  240.                         asection *));
  241.  
  242.   /* A function to get the ELF section index for a BFD section.  If
  243.      this returns true, the section was found.  If it is a normal ELF
  244.      section, *RETVAL should be left unchanged.  If it is not a normal
  245.      ELF section *RETVAL should be set to the SHN_xxxx index.  */
  246.   boolean (*elf_backend_section_from_bfd_section)
  247.     PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
  248.  
  249.   /* If this field is not NULL, it is called by the add_symbols phase
  250.      of a link just before adding a symbol to the global linker hash
  251.      table.  It may modify any of the fields as it wishes.  If *NAME
  252.      is set to NULL, the symbol will be skipped rather than being
  253.      added to the hash table.  This function is responsible for
  254.      handling all processor dependent symbol bindings and section
  255.      indices, and must set at least *FLAGS and *SEC for each processor
  256.      dependent case; failure to do so will cause a link error.  */
  257.   boolean (*elf_add_symbol_hook)
  258.     PARAMS ((bfd *abfd, struct bfd_link_info *info,
  259.          const Elf_Internal_Sym *, const char **name,
  260.          flagword *flags, asection **sec, bfd_vma *value));
  261.  
  262.   /* If this field is not NULL, it is called by the elf_link_output_sym
  263.      phase of a link for each symbol which will appear in the object file.  */
  264.   boolean (*elf_backend_link_output_symbol_hook)
  265.     PARAMS ((bfd *, struct bfd_link_info *info, const char *,
  266.          Elf_Internal_Sym *, asection *));
  267.  
  268.   /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
  269.      linker the first time it encounters a dynamic object in the link.
  270.      This function must create any sections required for dynamic
  271.      linking.  The ABFD argument is a dynamic object.  The .interp,
  272.      .dynamic, .dynsym, .dynstr, and .hash functions have already been
  273.      created, and this function may modify the section flags if
  274.      desired.  This function will normally create the .got and .plt
  275.      sections, but different backends have different requirements.  */
  276.   boolean (*elf_backend_create_dynamic_sections)
  277.     PARAMS ((bfd *abfd, struct bfd_link_info *info));
  278.  
  279.   /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
  280.      linker for every symbol which is defined by a dynamic object and
  281.      referenced by a regular object.  This is called after all the
  282.      input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
  283.      function has been called.  The hash table entry should be
  284.      bfd_link_hash_defined, and it should be defined in a section from
  285.      a dynamic object.  Dynamic object sections are not included in
  286.      the final link, and this function is responsible for changing the
  287.      value to something which the rest of the link can deal with.
  288.      This will normally involve adding an entry to the .plt or .got or
  289.      some such section, and setting the symbol to point to that.  */
  290.   boolean (*elf_backend_adjust_dynamic_symbol)
  291.     PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
  292.  
  293.   /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
  294.      linker after all the linker input files have been seen but before
  295.      the sections sizes have been set.  This is called after
  296.      ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
  297.      It is only called when linking against a dynamic object.  It must
  298.      set the sizes of the dynamic sections, and may fill in their
  299.      contents as well.  The generic ELF linker can handle the .dynsym,
  300.      .dynstr and .hash sections.  This function must handle the
  301.      .interp section and any sections created by the
  302.      CREATE_DYNAMIC_SECTIONS entry point.  */
  303.   boolean (*elf_backend_size_dynamic_sections)
  304.     PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
  305.  
  306.   /* The RELOCATE_SECTION function is called by the ELF backend linker
  307.      to handle the relocations for a section.
  308.  
  309.      The relocs are always passed as Rela structures; if the section
  310.      actually uses Rel structures, the r_addend field will always be
  311.      zero.
  312.  
  313.      This function is responsible for adjust the section contents as
  314.      necessary, and (if using Rela relocs and generating a
  315.      relocateable output file) adjusting the reloc addend as
  316.      necessary.
  317.  
  318.      This function does not have to worry about setting the reloc
  319.      address or the reloc symbol index.
  320.  
  321.      LOCAL_SYMS is a pointer to the swapped in local symbols.
  322.  
  323.      LOCAL_SECTIONS is an array giving the section in the input file
  324.      corresponding to the st_shndx field of each local symbol.
  325.  
  326.      The global hash table entry for the global symbols can be found
  327.      via elf_sym_hashes (input_bfd).
  328.  
  329.      When generating relocateable output, this function must handle
  330.      STB_LOCAL/STT_SECTION symbols specially.  The output symbol is
  331.      going to be the section symbol corresponding to the output
  332.      section, which means that the addend must be adjusted
  333.      accordingly.  */
  334.   boolean (*elf_backend_relocate_section)
  335.     PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
  336.          bfd *input_bfd, asection *input_section, bfd_byte *contents,
  337.          Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
  338.          asection **local_sections, char *output_names));
  339.  
  340.   /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
  341.      linker just before it writes a symbol out to the .dynsym section.
  342.      The processor backend may make any required adjustment to the
  343.      symbol.  It may also take the opportunity to set contents of the
  344.      dynamic sections.  Note that FINISH_DYNAMIC_SYMBOL is called on
  345.      all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
  346.      on those symbols which are defined by a dynamic object.  */
  347.   boolean (*elf_backend_finish_dynamic_symbol)
  348.     PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
  349.          struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
  350.  
  351.   /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
  352.      linker just before it writes all the dynamic sections out to the
  353.      output file.  The FINISH_DYNAMIC_SYMBOL will have been called on
  354.      all dynamic symbols.  */
  355.   boolean (*elf_backend_finish_dynamic_sections)
  356.     PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
  357.  
  358.   /* A function to do any beginning processing needed for the ELF file
  359.      before building the ELF headers and computing file positions.  */
  360.   void (*elf_backend_begin_write_processing)
  361.     PARAMS ((bfd *, struct bfd_link_info *));
  362.  
  363.   /* A function to do any final processing needed for the ELF file
  364.      before writing it out.  */
  365.   void (*elf_backend_final_write_processing)
  366.     PARAMS ((bfd *, struct bfd_link_info *));
  367.  
  368.   /* The swapping table to use when dealing with ECOFF information.
  369.      Used for the MIPS ELF .mdebug section.  */
  370.   const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
  371. };
  372.  
  373. struct elf_sym_extra
  374. {
  375.   int elf_sym_num;        /* sym# after locals/globals are reordered */
  376. };
  377.  
  378. typedef struct elf_sym_extra Elf_Sym_Extra;
  379.  
  380. /* Information stored for each BFD section in an ELF file.  This
  381.    structure is allocated by elf_new_section_hook.  */
  382.  
  383. struct bfd_elf_section_data {
  384.   /* The ELF header for this section.  */
  385.   Elf_Internal_Shdr this_hdr;
  386.   /* The ELF header for the reloc section associated with this
  387.      section, if any.  */
  388.   Elf_Internal_Shdr rel_hdr;
  389.   /* The ELF section number of this section.  Only used for an output
  390.      file.  */
  391.   int this_idx;
  392.   /* The ELF section number of the reloc section associated with this
  393.      section, if any.  Only used for an output file.  */
  394.   int rel_idx;
  395.   /* Used by the backend linker to store the symbol hash table entries
  396.      associated with relocs against global symbols.  */
  397.   struct elf_link_hash_entry **rel_hashes;
  398.   /* A pointer to the unswapped external relocs; this may be NULL.  */
  399.   PTR relocs;
  400. };
  401.  
  402. #define elf_section_data(sec)  ((struct bfd_elf_section_data*)sec->used_by_bfd)
  403.  
  404. #define get_elf_backend_data(abfd) \
  405.   ((struct elf_backend_data *) (abfd)->xvec->backend_data)
  406.  
  407. struct strtab
  408. {
  409.   char *tab;
  410.   int nentries;
  411.   int length;
  412. };
  413.  
  414. /* Some private data is stashed away for future use using the tdata pointer
  415.    in the bfd structure.  */
  416.  
  417. struct elf_obj_tdata
  418. {
  419.   Elf_Internal_Ehdr elf_header[1];    /* Actual data, but ref like ptr */
  420.   Elf_Internal_Shdr **elf_sect_ptr;
  421.   Elf_Internal_Phdr *phdr;
  422.   struct strtab *strtab_ptr;
  423.   int num_locals;
  424.   int num_globals;
  425.   Elf_Sym_Extra *sym_extra;
  426.   asymbol **section_syms;    /* STT_SECTION symbols for each section */
  427.   int num_section_syms;        /* number of section_syms allocated */
  428.   Elf_Internal_Shdr symtab_hdr;
  429.   Elf_Internal_Shdr shstrtab_hdr;
  430.   Elf_Internal_Shdr strtab_hdr;
  431.   Elf_Internal_Shdr dynsymtab_hdr;
  432.   Elf_Internal_Shdr dynstrtab_hdr;
  433.   int symtab_section, shstrtab_section, strtab_section, dynsymtab_section;
  434.   file_ptr next_file_pos;
  435.   void *prstatus;        /* The raw /proc prstatus structure */
  436.   void *prpsinfo;        /* The raw /proc prpsinfo structure */
  437.   bfd_vma gp;            /* The gp value (MIPS only, for now) */
  438.   int gp_size;            /* The gp size (MIPS only, for now) */
  439.  
  440.   /* A mapping from external symbols to entries in the linker hash
  441.      table, used when linking.  This is indexed by the symbol index
  442.      minus the sh_info field of the symbol table header.  */
  443.   struct elf_link_hash_entry **sym_hashes;
  444.  
  445.   /* The linker ELF emulation code needs to let the backend ELF linker
  446.      know what filename should be used for a dynamic object if the
  447.      dynamic object is found using a search.  This field is used to
  448.      hold that information.  */
  449.   const char *dt_needed_name;
  450.  
  451.   /* Irix 5 often screws up the symbol table, sorting local symbols
  452.      after global symbols.  This flag is set if the symbol table in
  453.      this BFD appears to be screwed up.  If it is, we ignore the
  454.      sh_info field in the symbol table header, and always read all the
  455.      symbols.  */
  456.   boolean bad_symtab;
  457. };
  458.  
  459. #define elf_tdata(bfd)        ((bfd) -> tdata.elf_obj_data)
  460. #define elf_elfheader(bfd)    (elf_tdata(bfd) -> elf_header)
  461. #define elf_elfsections(bfd)    (elf_tdata(bfd) -> elf_sect_ptr)
  462. #define elf_shstrtab(bfd)    (elf_tdata(bfd) -> strtab_ptr)
  463. #define elf_onesymtab(bfd)    (elf_tdata(bfd) -> symtab_section)
  464. #define elf_dynsymtab(bfd)    (elf_tdata(bfd) -> dynsymtab_section)
  465. #define elf_num_locals(bfd)    (elf_tdata(bfd) -> num_locals)
  466. #define elf_num_globals(bfd)    (elf_tdata(bfd) -> num_globals)
  467. #define elf_sym_extra(bfd)    (elf_tdata(bfd) -> sym_extra)
  468. #define elf_section_syms(bfd)    (elf_tdata(bfd) -> section_syms)
  469. #define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
  470. #define core_prpsinfo(bfd)    (elf_tdata(bfd) -> prpsinfo)
  471. #define core_prstatus(bfd)    (elf_tdata(bfd) -> prstatus)
  472. #define elf_gp(bfd)        (elf_tdata(bfd) -> gp)
  473. #define elf_gp_size(bfd)    (elf_tdata(bfd) -> gp_size)
  474. #define elf_sym_hashes(bfd)    (elf_tdata(bfd) -> sym_hashes)
  475. #define elf_dt_needed_name(bfd)    (elf_tdata(bfd) -> dt_needed_name)
  476. #define elf_bad_symtab(bfd)    (elf_tdata(bfd) -> bad_symtab)
  477.  
  478. extern char * elf_string_from_elf_section PARAMS ((bfd *, unsigned, unsigned));
  479. extern char * elf_get_str_section PARAMS ((bfd *, unsigned));
  480.  
  481. #define bfd_elf32_mkobject    bfd_elf_mkobject
  482. #define bfd_elf64_mkobject    bfd_elf_mkobject
  483. #define elf_mkobject        bfd_elf_mkobject
  484.  
  485. extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *));
  486.  
  487. extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
  488.                                 arelent *,
  489.                                 asymbol *,
  490.                                 PTR,
  491.                                 asection *,
  492.                                 bfd *,
  493.                                 char **));
  494. extern boolean bfd_elf_mkobject PARAMS ((bfd *));
  495. extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
  496. extern boolean _bfd_elf_make_section_from_shdr
  497.   PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name));
  498. extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
  499.   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
  500. extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
  501.   PARAMS ((bfd *));
  502. extern boolean _bfd_elf_link_hash_table_init
  503.   PARAMS ((struct elf_link_hash_table *, bfd *,
  504.        struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
  505.                        struct bfd_hash_table *,
  506.                        const char *)));
  507.  
  508. extern boolean bfd_elf32_write_object_contents PARAMS ((bfd *));
  509. extern boolean bfd_elf64_write_object_contents PARAMS ((bfd *));
  510.  
  511. extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
  512. extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
  513. extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
  514. extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *));
  515. extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *,
  516.                                  bfd *));
  517. extern boolean bfd_elf32_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
  518.                                file_ptr,
  519.                                bfd_size_type));
  520.  
  521. extern long bfd_elf32_get_symtab_upper_bound PARAMS ((bfd *));
  522. extern long bfd_elf32_get_symtab PARAMS ((bfd *, asymbol **));
  523. extern long bfd_elf32_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
  524. extern long bfd_elf32_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **));
  525. extern long bfd_elf32_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
  526. extern long bfd_elf32_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
  527.                           arelent **, asymbol **));
  528. extern asymbol *bfd_elf32_make_empty_symbol PARAMS ((bfd *));
  529. extern void bfd_elf32_print_symbol PARAMS ((bfd *, PTR, asymbol *,
  530.                         bfd_print_symbol_type));
  531. extern void bfd_elf32_get_symbol_info PARAMS ((bfd *, asymbol *,
  532.                            symbol_info *));
  533. extern alent *bfd_elf32_get_lineno PARAMS ((bfd *, asymbol *));
  534. extern boolean bfd_elf32_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
  535.                         unsigned long));
  536. extern boolean bfd_elf32_find_nearest_line PARAMS ((bfd *, asection *,
  537.                             asymbol **,
  538.                             bfd_vma, CONST char **,
  539.                             CONST char **,
  540.                             unsigned int *));
  541. extern int bfd_elf32_sizeof_headers PARAMS ((bfd *, boolean));
  542. extern void bfd_elf32__write_relocs PARAMS ((bfd *, asection *, PTR));
  543. extern boolean bfd_elf32_new_section_hook PARAMS ((bfd *, asection *));
  544. extern boolean bfd_elf32_bfd_link_add_symbols
  545.   PARAMS ((bfd *, struct bfd_link_info *));
  546. extern boolean bfd_elf32_bfd_final_link
  547.   PARAMS ((bfd *, struct bfd_link_info *));
  548.  
  549. extern void bfd_elf32_swap_symbol_in
  550.   PARAMS ((bfd *, Elf32_External_Sym *, Elf_Internal_Sym *));
  551. extern void bfd_elf32_swap_symbol_out
  552.   PARAMS ((bfd *, Elf_Internal_Sym *, Elf32_External_Sym *));
  553. extern void bfd_elf32_swap_reloc_in
  554.   PARAMS ((bfd *, Elf32_External_Rel *, Elf_Internal_Rel *));
  555. extern void bfd_elf32_swap_reloc_out
  556.   PARAMS ((bfd *, Elf_Internal_Rel *, Elf32_External_Rel *));
  557. extern void bfd_elf32_swap_reloca_in
  558.   PARAMS ((bfd *, Elf32_External_Rela *, Elf_Internal_Rela *));
  559. extern void bfd_elf32_swap_reloca_out
  560.   PARAMS ((bfd *, Elf_Internal_Rela *, Elf32_External_Rela *));
  561. extern void bfd_elf32_swap_dyn_in
  562.   PARAMS ((bfd *, const Elf32_External_Dyn *, Elf_Internal_Dyn *));
  563. extern void bfd_elf32_swap_dyn_out
  564.   PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf32_External_Dyn *));
  565. extern boolean bfd_elf32_add_dynamic_entry
  566.   PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
  567.  
  568. /* If the target doesn't have reloc handling written yet:  */
  569. extern void bfd_elf32_no_info_to_howto PARAMS ((bfd *, arelent *,
  570.                         Elf32_Internal_Rela *));
  571.  
  572. extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *));
  573. extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *));
  574. extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *));
  575. extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *));
  576. extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *,
  577.                                  bfd *));
  578. extern boolean bfd_elf64_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
  579.                                file_ptr,
  580.                                bfd_size_type));
  581.  
  582. extern long bfd_elf64_get_symtab_upper_bound PARAMS ((bfd *));
  583. extern long bfd_elf64_get_symtab PARAMS ((bfd *, asymbol **));
  584. extern long bfd_elf64_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
  585. extern long bfd_elf64_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **));
  586. extern long bfd_elf64_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
  587. extern long bfd_elf64_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
  588.                           arelent **, asymbol **));
  589. extern asymbol *bfd_elf64_make_empty_symbol PARAMS ((bfd *));
  590. extern void bfd_elf64_print_symbol PARAMS ((bfd *, PTR, asymbol *,
  591.                         bfd_print_symbol_type));
  592. extern void bfd_elf64_get_symbol_info PARAMS ((bfd *, asymbol *,
  593.                            symbol_info *));
  594. extern alent *bfd_elf64_get_lineno PARAMS ((bfd *, asymbol *));
  595. extern boolean bfd_elf64_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
  596.                         unsigned long));
  597. extern boolean bfd_elf64_find_nearest_line PARAMS ((bfd *, asection *,
  598.                             asymbol **,
  599.                             bfd_vma, CONST char **,
  600.                             CONST char **,
  601.                             unsigned int *));
  602. extern int bfd_elf64_sizeof_headers PARAMS ((bfd *, boolean));
  603. extern void bfd_elf64__write_relocs PARAMS ((bfd *, asection *, PTR));
  604. extern boolean bfd_elf64_new_section_hook PARAMS ((bfd *, asection *));
  605. extern boolean bfd_elf64_bfd_link_add_symbols
  606.   PARAMS ((bfd *, struct bfd_link_info *));
  607. extern boolean bfd_elf64_bfd_final_link
  608.   PARAMS ((bfd *, struct bfd_link_info *));
  609.  
  610. extern void bfd_elf64_swap_symbol_in
  611.   PARAMS ((bfd *, Elf64_External_Sym *, Elf_Internal_Sym *));
  612. extern void bfd_elf64_swap_symbol_out
  613.   PARAMS ((bfd *, Elf_Internal_Sym *, Elf64_External_Sym *));
  614. extern void bfd_elf64_swap_reloc_in
  615.   PARAMS ((bfd *, Elf64_External_Rel *, Elf_Internal_Rel *));
  616. extern void bfd_elf64_swap_reloc_out
  617.   PARAMS ((bfd *, Elf_Internal_Rel *, Elf64_External_Rel *));
  618. extern void bfd_elf64_swap_reloca_in
  619.   PARAMS ((bfd *, Elf64_External_Rela *, Elf_Internal_Rela *));
  620. extern void bfd_elf64_swap_reloca_out
  621.   PARAMS ((bfd *, Elf_Internal_Rela *, Elf64_External_Rela *));
  622. extern void bfd_elf64_swap_dyn_in
  623.   PARAMS ((bfd *, const Elf64_External_Dyn *, Elf_Internal_Dyn *));
  624. extern void bfd_elf64_swap_dyn_out
  625.   PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf64_External_Dyn *));
  626. extern boolean bfd_elf64_add_dynamic_entry
  627.   PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
  628.  
  629. /* If the target doesn't have reloc handling written yet:  */
  630. extern void bfd_elf64_no_info_to_howto PARAMS ((bfd *, arelent *,
  631.                         Elf64_Internal_Rela *));
  632.  
  633. #endif /* _LIBELF_H_ */
  634.