Fix date.
[deliverable/binutils-gdb.git] / bfd / elf-bfd.h
index 3323aaaa7670f96992083f2151c1b14983c513b6..ef219e4411d893d13de7a87a066372ac0721ec00 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end data structures for ELF files.
-   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
+   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+   2002 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -223,6 +223,16 @@ struct elf_link_local_dynamic_entry
   Elf_Internal_Sym isym;
 };
 
+enum elf_link_info_type
+{
+  ELF_INFO_TYPE_NONE,
+  ELF_INFO_TYPE_STABS,
+  ELF_INFO_TYPE_MERGE,
+  ELF_INFO_TYPE_EH_FRAME,
+  ELF_INFO_TYPE_EH_FRAME_HDR,
+  ELF_INFO_TYPE_LAST
+};
+
 /* ELF linker hash table.  */
 
 struct elf_link_hash_table
@@ -332,7 +342,7 @@ struct elf_size_info {
   void (*write_relocs)
     PARAMS ((bfd *, asection *, PTR));
   void (*swap_symbol_out)
-    PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
+    PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
   boolean (*slurp_reloc_table)
     PARAMS ((bfd *, asection *, asymbol **, boolean));
   long (*slurp_symbol_table)
@@ -384,7 +394,8 @@ enum elf_reloc_type_class {
 struct elf_reloc_cookie
 {
   Elf_Internal_Rela *rels, *rel, *relend;
-  void *locsyms;
+  PTR locsyms;
+  PTR locsym_shndx;
   bfd *abfd;
   size_t locsymcount;
   size_t extsymoff;
@@ -392,6 +403,14 @@ struct elf_reloc_cookie
   boolean bad_symtab;
 };
 
+/* The level of IRIX compatibility we're striving for.  */
+
+typedef enum {
+  ict_none,
+  ict_irix5,
+  ict_irix6
+} irix_compat_t;
+
 struct elf_backend_data
 {
   /* The architecture for this backend.  */
@@ -482,7 +501,7 @@ struct elf_backend_data
      section, *RETVAL should be left unchanged.  If it is not a normal
      ELF section *RETVAL should be set to the SHN_xxxx index.  */
   boolean (*elf_backend_section_from_bfd_section)
-    PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
+    PARAMS ((bfd *, asection *, int *retval));
 
   /* If this field is not NULL, it is called by the add_symbols phase
      of a link just before adding a symbol to the global linker hash
@@ -682,7 +701,7 @@ struct elf_backend_data
   /* Modify any information related to dynamic linking such that the
      symbol is not exported.  */
   void (*elf_backend_hide_symbol)
-    PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+    PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
 
   /* Emit relocations.  Overrides default routine for emitting relocs,
      except during a relocatable link, or if all relocs are being emitted.  */
@@ -729,6 +748,14 @@ struct elf_backend_data
   boolean (*elf_backend_write_section)
     PARAMS ((bfd *, asection *, bfd_byte *));
 
+  /* The level of IRIX compatibility we're striving for.
+     MIPS ELF specific function.  */
+  irix_compat_t (*elf_backend_mips_irix_compat)
+    PARAMS ((bfd *));
+
+  reloc_howto_type *(*elf_backend_mips_rtype_to_howto)
+    PARAMS ((unsigned int, boolean));
+
   /* 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;
@@ -848,11 +875,11 @@ struct bfd_elf_section_data
      no dynamic symbol for this section.  */
   long dynindx;
 
-  /* A pointer used for .stab linking optimizations.  */
-  PTR stab_info;
+  /* A pointer used for various section optimizations.  */
+  PTR sec_info;
 
-  /* A pointer used for SEC_MERGE optimizations.  */
-  PTR merge_info;
+  /* Type of that information.  */
+  enum elf_link_info_type sec_info_type;
 
   /* Group name, if this section is part of a group.  */
   const char *group_name;
@@ -872,6 +899,12 @@ struct bfd_elf_section_data
 #define elf_group_name(sec)    (elf_section_data(sec)->group_name)
 #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
 
+/* Return true if section has been discarded.  */
+#define elf_discarded_section(sec)                                     \
+  (!bfd_is_abs_section(sec)                                            \
+   && bfd_is_abs_section((sec)->output_section)                                \
+   && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
+
 #define get_elf_backend_data(abfd) \
   ((struct elf_backend_data *) (abfd)->xvec->backend_data)
 
@@ -933,6 +966,7 @@ struct elf_obj_tdata
   struct elf_strtab_hash *strtab_ptr;
   int num_locals;
   int num_globals;
+  unsigned int num_elf_sections;       /* elf_sect_ptr size */
   int num_section_syms;
   asymbol **section_syms;              /* STT_SECTION symbols for each section */
   Elf_Internal_Shdr symtab_hdr;
@@ -943,8 +977,10 @@ struct elf_obj_tdata
   Elf_Internal_Shdr dynversym_hdr;
   Elf_Internal_Shdr dynverref_hdr;
   Elf_Internal_Shdr dynverdef_hdr;
+  Elf_Internal_Shdr symtab_shndx_hdr;
   unsigned int symtab_section, shstrtab_section;
   unsigned int strtab_section, dynsymtab_section;
+  unsigned int symtab_shndx_section;
   unsigned int dynversym_section, dynverdef_section, dynverref_section;
   file_ptr next_file_pos;
 #if 0
@@ -1043,6 +1079,10 @@ struct elf_obj_tdata
   /* Used to determine if the e_flags field has been initialized */
   boolean flags_init;
 
+  /* Used to determine if PT_GNU_EH_FRAME segment header should be
+     created.  */
+  boolean eh_frame_hdr;
+
   /* Number of symbol version definitions we are about to emit.  */
   unsigned int cverdefs;
 
@@ -1069,8 +1109,10 @@ struct elf_obj_tdata
 #define elf_tdata(bfd)         ((bfd) -> tdata.elf_obj_data)
 #define elf_elfheader(bfd)     (elf_tdata(bfd) -> elf_header)
 #define elf_elfsections(bfd)   (elf_tdata(bfd) -> elf_sect_ptr)
+#define elf_numsections(bfd)   (elf_tdata(bfd) -> num_elf_sections)
 #define elf_shstrtab(bfd)      (elf_tdata(bfd) -> strtab_ptr)
 #define elf_onesymtab(bfd)     (elf_tdata(bfd) -> symtab_section)
+#define elf_symtab_shndx(bfd)  (elf_tdata(bfd) -> symtab_shndx_section)
 #define elf_dynsymtab(bfd)     (elf_tdata(bfd) -> dynsymtab_section)
 #define elf_dynversym(bfd)     (elf_tdata(bfd) -> dynversym_section)
 #define elf_dynverdef(bfd)     (elf_tdata(bfd) -> dynverdef_section)
@@ -1121,6 +1163,8 @@ extern char *bfd_elf_string_from_elf_section
 extern char *bfd_elf_get_str_section
   PARAMS ((bfd *, unsigned));
 
+extern boolean _bfd_elf_copy_private_bfd_data
+  PARAMS ((bfd *, bfd *));
 extern boolean _bfd_elf_print_private_bfd_data
   PARAMS ((bfd *, PTR));
 extern void bfd_elf_print_symbol
@@ -1169,7 +1213,7 @@ extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
 extern void _bfd_elf_link_hash_copy_indirect
   PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
 extern void _bfd_elf_link_hash_hide_symbol
-  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
 extern boolean _bfd_elf_link_hash_table_init
   PARAMS ((struct elf_link_hash_table *, bfd *,
           struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
@@ -1271,6 +1315,20 @@ extern boolean _bfd_elf_strtab_emit
 extern void _bfd_elf_strtab_finalize
   PARAMS ((struct elf_strtab_hash *));
 
+extern boolean _bfd_elf_discard_section_eh_frame
+  PARAMS ((bfd *, struct bfd_link_info *, asection *, asection *,
+          boolean (*) (bfd_vma, PTR), struct elf_reloc_cookie *));
+extern boolean _bfd_elf_discard_section_eh_frame_hdr
+  PARAMS ((bfd *, struct bfd_link_info *, asection *));
+extern bfd_vma _bfd_elf_eh_frame_section_offset
+  PARAMS ((bfd *, asection *, bfd_vma));
+extern boolean _bfd_elf_write_section_eh_frame
+  PARAMS ((bfd *, asection *, asection *, bfd_byte *));
+extern boolean _bfd_elf_write_section_eh_frame_hdr
+  PARAMS ((bfd *, asection *));
+extern boolean _bfd_elf_maybe_strip_eh_frame_hdr
+  PARAMS ((struct bfd_link_info *));
+
 extern boolean _bfd_elf_link_record_dynamic_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 extern long _bfd_elf_link_lookup_local_dynindx
@@ -1343,9 +1401,10 @@ extern boolean bfd_elf32_bfd_final_link
   PARAMS ((bfd *, struct bfd_link_info *));
 
 extern void bfd_elf32_swap_symbol_in
-  PARAMS ((bfd *, const Elf32_External_Sym *, Elf_Internal_Sym *));
+  PARAMS ((bfd *, const Elf32_External_Sym *, const Elf_External_Sym_Shndx *,
+          Elf_Internal_Sym *));
 extern void bfd_elf32_swap_symbol_out
-  PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
+  PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
 extern void bfd_elf32_swap_reloc_in
   PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *));
 extern void bfd_elf32_swap_reloc_out
@@ -1395,9 +1454,10 @@ extern boolean bfd_elf64_bfd_final_link
   PARAMS ((bfd *, struct bfd_link_info *));
 
 extern void bfd_elf64_swap_symbol_in
-  PARAMS ((bfd *, const Elf64_External_Sym *, Elf_Internal_Sym *));
+  PARAMS ((bfd *, const Elf64_External_Sym *, const Elf_External_Sym_Shndx *,
+          Elf_Internal_Sym *));
 extern void bfd_elf64_swap_symbol_out
-  PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
+  PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
 extern void bfd_elf64_swap_reloc_in
   PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *));
 extern void bfd_elf64_swap_reloc_out
@@ -1474,86 +1534,21 @@ extern boolean _bfd_elf32_reloc_symbol_deleted_p
 extern boolean _bfd_elf64_reloc_symbol_deleted_p
   PARAMS ((bfd_vma, PTR));
 
-/* MIPS ELF specific routines.  */
-
-extern boolean _bfd_mips_elf_object_p
-  PARAMS ((bfd *));
-extern boolean _bfd_mips_elf_section_from_shdr
-  PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
-extern boolean _bfd_mips_elf_fake_sections
-  PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
-extern boolean _bfd_mips_elf_section_from_bfd_section
-  PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, int *));
-extern boolean _bfd_mips_elf_section_processing
-  PARAMS ((bfd *, Elf_Internal_Shdr *));
-extern void _bfd_mips_elf_symbol_processing
-  PARAMS ((bfd *, asymbol *));
-extern boolean _bfd_mips_elf_read_ecoff_info
-  PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
-extern void _bfd_mips_elf_final_write_processing
-  PARAMS ((bfd *, boolean));
-extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-extern bfd_reloc_status_type _bfd_mips_elf_gprel16_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc
-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-extern boolean _bfd_mips_elf_set_private_flags
-  PARAMS ((bfd *, flagword));
-extern boolean _bfd_mips_elf_copy_private_bfd_data
-  PARAMS ((bfd *, bfd *));
-extern boolean _bfd_mips_elf_merge_private_bfd_data
-  PARAMS ((bfd *, bfd *));
-extern boolean _bfd_mips_elf_find_nearest_line
-  PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
-          const char **, unsigned int *));
-extern boolean _bfd_mips_elf_set_section_contents
-  PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-extern boolean _bfd_mips_elf_create_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_mips_elf_add_symbol_hook
-  PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
-          const char **, flagword *, asection **, bfd_vma *));
-extern boolean _bfd_mips_elf_adjust_dynamic_symbol
-  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-extern boolean _bfd_mips_elf_finish_dynamic_symbol
-  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
-          Elf_Internal_Sym *));
-extern boolean _bfd_mips_elf_finish_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern asection * _bfd_mips_elf_gc_mark_hook
-  PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
-          struct elf_link_hash_entry *, Elf_Internal_Sym *));
-extern boolean _bfd_mips_elf_gc_sweep_hook
-  PARAMS ((bfd *, struct bfd_link_info *, asection *,
-          const Elf_Internal_Rela *));
-extern boolean _bfd_mips_elf_always_size_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_mips_elf_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_mips_elf_check_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, asection *,
-          const Elf_Internal_Rela *));
-extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create
-  PARAMS ((bfd *));
-extern boolean _bfd_mips_elf_print_private_bfd_data
-  PARAMS ((bfd *, PTR));
-extern boolean _bfd_mips_elf_link_output_symbol_hook
-  PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
-          asection *));
-extern boolean _bfd_mips_elf_final_link
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern int _bfd_mips_elf_additional_program_headers
-  PARAMS ((bfd *));
-extern boolean _bfd_mips_elf_modify_segment_map
-  PARAMS ((bfd *));
-extern boolean _bfd_mips_elf_relocate_section
-  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
-          Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+/* Exported interface for writing elf corefile notes. */
+extern char *elfcore_write_note 
+  PARAMS ((bfd *, char *, int *, char *, int, void *, int));
+extern char *elfcore_write_prpsinfo 
+  PARAMS ((bfd *, char *, int *, char *, char *));
+extern char *elfcore_write_prstatus 
+  PARAMS ((bfd *, char *, int *, long, int, void *));
+extern char * elfcore_write_pstatus 
+  PARAMS ((bfd *, char *, int *, long, int, void *));
+extern char *elfcore_write_prfpreg 
+  PARAMS ((bfd *, char *, int *, void *, int));
+extern char *elfcore_write_prxfpreg 
+  PARAMS ((bfd *, char *, int *, void *, int));
+extern char *elfcore_write_lwpstatus 
+  PARAMS ((bfd*, char*, int*, long, int, void*));
 
 /* SH ELF specific routine.  */
 
This page took 0.027931 seconds and 4 git commands to generate.