2001-08-10 H.J. Lu <hjl@gnu.org>
[deliverable/binutils-gdb.git] / bfd / elf-bfd.h
index d88e4a3947ceff51b9e9dc5ad3288a5f78fd3356..b0e20ea9aa640bc500cdd5a8554f36c8929c2ef0 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end data structures for ELF files.
-   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000 Free Software
-   Foundation, Inc.
+   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -27,6 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "elf/external.h"
 #include "bfdlink.h"
 
+/* The number of entries in a section is its size divided by the size
+   of a single entry.  This is normally only applicaable to reloc and
+   symbol table sections.  */
+#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
+
 /* If size isn't specified as 64 or 32, NAME macro should fail.  */
 #ifndef NAME
 #if ARCH_SIZE==64
@@ -208,7 +213,7 @@ struct elf_link_local_dynamic_entry
 
   /* The index in the outgoing dynamic symbol table.  */
   long dynindx;
-  
+
   /* A copy of the input symbol.  */
   Elf_Internal_Sym isym;
 };
@@ -241,6 +246,8 @@ struct elf_link_hash_table
   struct elf_link_hash_entry *hgot;
   /* A pointer to information used to link stabs in sections.  */
   PTR stab_info;
+  /* A pointer to information used to merge SEC_MERGE sections.  */
+  PTR merge_info;
   /* A linked list of local symbols to be added to .dynsym.  */
   struct elf_link_local_dynamic_entry *dynlocal;
   /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
@@ -375,7 +382,7 @@ struct elf_backend_data
                                                          unsigned int));
 
    /* A function to set the type of the info field.  Processor-specific
-     types should be handled here. */
+     types should be handled here.  */
   int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int));
 
   /* A function to do additional processing on the ELF section header
@@ -397,7 +404,7 @@ struct elf_backend_data
                                                Elf32_Internal_Shdr *));
 
   /* A function to handle unusual program segment types when creating BFD
-     sections from ELF program segments. */
+     sections from ELF program segments.  */
   boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
                                                    Elf32_Internal_Phdr *,
                                                    int));
@@ -611,6 +618,24 @@ struct elf_backend_data
   void (*elf_backend_hide_symbol)
     PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 
+  /* Emit relocations.  Overrides default routine for emitting relocs,
+     except during a relocatable link, or if all relocs are being emitted.  */
+  void (*elf_backend_emit_relocs)
+    PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
+
+  /* Count relocations.  Not called for relocatable links
+     or if all relocs are being preserved in the output.  */
+  unsigned int (*elf_backend_count_relocs)
+    PARAMS ((asection *, Elf_Internal_Rela *));
+
+  /* This function, if defined, is called when an NT_PRSTATUS note is found
+     in a core file. */
+  boolean (*elf_backend_grok_prstatus) PARAMS ((bfd *, Elf_Internal_Note *));
+
+  /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
+     note is found in a core file. */
+  boolean (*elf_backend_grok_psinfo) PARAMS ((bfd *, Elf_Internal_Note *));
+
   /* The swapping table to use when dealing with ECOFF information.
      Used for the MIPS ELF .mdebug section.  */
   const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
@@ -669,6 +694,7 @@ struct elf_backend_data
   unsigned plt_not_loaded : 1;
   unsigned plt_alignment : 4;
   unsigned can_gc_sections : 1;
+  unsigned want_got_sym : 1;
   unsigned want_dynbss : 1;
 };
 
@@ -712,6 +738,8 @@ struct bfd_elf_section_data
   long dynindx;
   /* A pointer used for .stab linking optimizations.  */
   PTR stab_info;
+  /* A pointer used for SEC_MERGE optimizations.  */
+  PTR merge_info;
   /* A pointer available for the processor specific ELF backend.  */
   PTR tdata;
   /* Nonzero if this section uses RELA relocations, rather than REL.  */
@@ -796,14 +824,14 @@ struct elf_obj_tdata
   file_ptr next_file_pos;
 #if 0
   /* we don't need these inside bfd anymore, and I think
-     these weren't used outside bfd. */
+     these weren't used outside bfd.  */
   void *prstatus;                      /* The raw /proc prstatus structure */
   void *prpsinfo;                      /* The raw /proc prpsinfo structure */
 #endif
   bfd_vma gp;                          /* The gp value (MIPS only, for now) */
   unsigned int gp_size;                        /* The gp size (MIPS only, for now) */
 
-  /* Information grabbed from an elf core file. */
+  /* Information grabbed from an elf core file.  */
   int core_signal;
   int core_pid;
   int core_lwpid;
@@ -825,7 +853,7 @@ struct elf_obj_tdata
      document the intent of any particular piece of code.  The field
      should be used as a count until size_dynamic_sections, at which
      point the contents of the .got is fixed.  Afterward, if an entry
-     is -1, then the symbol does not require a global offset table entry. */
+     is -1, then the symbol does not require a global offset table entry.  */
   union
     {
       bfd_signed_vma *refcounts;
@@ -851,7 +879,7 @@ struct elf_obj_tdata
      ELF emulation code, we need to add the shared object to the
      DT_NEEDED list of the resulting binary to indicate the dependency
      as if the -l option is passed to the linker. This field holds the
-     name of the loaded shared object. */
+     name of the loaded shared object.  */
   const char *dt_soname;
 
   /* Irix 5 often screws up the symbol table, sorting local symbols
@@ -873,10 +901,10 @@ struct elf_obj_tdata
      find_nearest_line.  */
   struct mips_elf_find_line *find_line_info;
 
-  /* A place to stash dwarf1 info for this bfd. */
+  /* A place to stash dwarf1 info for this bfd.  */
   struct dwarf1_debug *dwarf1_find_line_info;
 
-  /* A place to stash dwarf2 info for this bfd. */
+  /* A place to stash dwarf2 info for this bfd.  */
   PTR dwarf2_find_line_info;
 
   /* An array of stub sections indexed by symbol number, used by the
@@ -971,6 +999,9 @@ extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *,
 #define bfd_elf32_print_symbol bfd_elf_print_symbol
 #define bfd_elf64_print_symbol bfd_elf_print_symbol
 
+extern void bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+
 extern unsigned long bfd_elf_hash PARAMS ((const char *));
 
 extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
@@ -1002,6 +1033,9 @@ extern boolean _bfd_elf_link_hash_table_init
                                       const char *)));
 extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *));
 
+extern boolean _bfd_elf_merge_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+
 extern boolean _bfd_elf_copy_private_symbol_data
   PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
 extern boolean _bfd_elf_copy_private_section_data
@@ -1076,6 +1110,9 @@ boolean _bfd_elf_create_got_section PARAMS ((bfd *,
 unsigned long _bfd_elf_link_renumber_dynsyms PARAMS ((bfd *,
                                                      struct bfd_link_info *));
 
+boolean _bfd_elfcore_make_pseudosection PARAMS ((bfd *, char *, int, int));
+char *_bfd_elfcore_strndup PARAMS ((bfd *, char *, int));
+
 elf_linker_section_t *_bfd_elf_create_linker_section
   PARAMS ((bfd *abfd,
           struct bfd_link_info *info,
@@ -1126,9 +1163,6 @@ boolean _bfd_elf_make_linker_section_rela
           elf_linker_section_t *lsect,
           int alignment));
 
-boolean _bfd_elfcore_section_from_phdr
-  PARAMS ((bfd *, Elf_Internal_Phdr *, int));
-
 extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
 extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
 extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
This page took 0.028819 seconds and 4 git commands to generate.