bfd/
[deliverable/binutils-gdb.git] / bfd / elf-bfd.h
index dbcebd2c6bbf6eb5b1feab279f9f93583f3ee621..66dcbcd5eac253794fed02cb0169b7e49388f12e 100644 (file)
@@ -1319,6 +1319,23 @@ struct elf_backend_data
   unsigned default_execstack : 1;
 };
 
+/* Information about reloc sections associated with a bfd_elf_section_data
+   structure.  */
+struct bfd_elf_section_reloc_data
+{
+  /* The ELF header for the reloc section associated with this
+     section, if any.  */
+  Elf_Internal_Shdr *hdr;
+  /* The number of relocations currently assigned to HDR.  */
+  unsigned int count;
+  /* The ELF section number of the reloc section.  Only used for an
+     output file.  */
+  int idx;
+  /* Used by the backend linker to store the symbol hash table entries
+     associated with relocs against global symbols.  */
+  struct elf_link_hash_entry **hashes;
+};
+
 /* Information stored for each BFD section in an ELF file.  This
    structure is allocated by elf_new_section_hook.  */
 
@@ -1327,31 +1344,13 @@ struct bfd_elf_section_data
   /* The ELF header for this section.  */
   Elf_Internal_Shdr this_hdr;
 
-  /* The ELF header for the reloc section associated with this
-     section, if any.  */
-  Elf_Internal_Shdr rel_hdr;
-
-  /* If there is a second reloc section associated with this section,
-     as can happen on Irix 6, this field points to the header.  */
-  Elf_Internal_Shdr *rel_hdr2;
-
-  /* The number of relocations currently assigned to REL_HDR.  */
-  unsigned int rel_count;
-
-  /* The number of relocations currently assigned to REL_HDR2.  */
-  unsigned int rel_count2;
+  /* Information about the REL and RELA reloc sections associated
+     with this section, if any.  */
+  struct bfd_elf_section_reloc_data rel, rela;
 
   /* The ELF section number of this section.  */
   int this_idx;
 
-  /* The ELF section number of the reloc section indicated by
-     REL_HDR if any.  Only used for an output file.  */
-  int rel_idx;
-
-  /* The ELF section number of the reloc section indicated by
-     REL_HDR2 if any.  Only used for an output file.  */
-  int rel_idx2;
-
   /* Used by the backend linker when generating a shared library to
      record the dynamic symbol index for a section symbol
      corresponding to this section.  A value of 0 means that there is
@@ -1361,10 +1360,6 @@ struct bfd_elf_section_data
   /* A pointer to the linked-to section for SHF_LINK_ORDER.  */
   asection *linked_to;
 
-  /* Used by the backend linker to store the symbol hash table entries
-     associated with relocs against global symbols.  */
-  struct elf_link_hash_entry **rel_hashes;
-
   /* A pointer to the swapped relocs.  If the section uses REL relocs,
      rather than RELA, all the r_addend fields will be zero.  This
      pointer may be NULL.  It is used by the backend linker.  */
@@ -1852,7 +1847,7 @@ extern int _bfd_elf_sizeof_headers
 extern bfd_boolean _bfd_elf_new_section_hook
   (bfd *, asection *);
 extern bfd_boolean _bfd_elf_init_reloc_shdr
-  (bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean);
+  (bfd *, struct bfd_elf_section_reloc_data *, asection *, bfd_boolean);
 extern const struct bfd_elf_special_section *_bfd_elf_get_special_section
   (const char *, const struct bfd_elf_special_section *, unsigned int);
 extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
@@ -2237,6 +2232,7 @@ extern void _bfd_elf_copy_obj_attributes (bfd *, bfd *);
 extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, int);
 extern void _bfd_elf_parse_attributes (bfd *, Elf_Internal_Shdr *);
 extern bfd_boolean _bfd_elf_merge_object_attributes (bfd *, bfd *);
+extern Elf_Internal_Shdr *_bfd_elf_single_rel_hdr (asection *sec);
 
 /* The linker may needs to keep track of the number of relocs that it
    decides to copy as dynamic relocs in check_relocs for each symbol.
@@ -2363,13 +2359,13 @@ extern asection _bfd_elf_large_com_section;
           sections may require relocations.  */                        \
        Elf_Internal_Shdr *rel_hdr;                                     \
                                                                        \
-       rel_hdr = &elf_section_data (input_section->output_section)->rel_hdr; \
+       rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); \
                                                                        \
        /* Avoid empty output section.  */                              \
        if (rel_hdr->sh_size > rel_hdr->sh_entsize)                     \
          {                                                             \
            rel_hdr->sh_size -= rel_hdr->sh_entsize;                    \
-           rel_hdr = &elf_section_data (input_section)->rel_hdr;       \
+           rel_hdr = _bfd_elf_single_rel_hdr (input_section);          \
            rel_hdr->sh_size -= rel_hdr->sh_entsize;                    \
                                                                        \
            memmove (rel, rel + 1, (relend - rel) * sizeof (*rel));     \
This page took 0.025572 seconds and 4 git commands to generate.