include/elf/ChangeLog
[binutils-gdb.git] / bfd / elf32-i370.c
index fc82b47a080ef20c0faf93d717737a36eb91941b..f9a94a138f66e24b110bc2360809d500ee12f00f 100644 (file)
@@ -34,32 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "elf-bfd.h"
 #include "elf/i370.h"
 
-#define USE_RELA               /* we want RELA relocations, not REL */
-
-/* i370 relocations */
-/* Note that there is really just one relocation that we currently
- * support (and only one that we seem to need, at the moment), and
- * that is the 31-bit address relocation.  Note that the 370/390
- * only supports a 31-bit (2GB) address space.
- */
-enum i370_reloc_type
-{
-  R_I370_NONE          =   0,
-  R_I370_ADDR31                =   1,
-  R_I370_ADDR32                =   2,
-  R_I370_ADDR16                =   3,
-  R_I370_REL31         =   4,
-  R_I370_REL32         =   5,
-  R_I370_ADDR12                =   6,
-  R_I370_REL12         =   7,
-  R_I370_ADDR8         =   8,
-  R_I370_REL8          =   9,
-  R_I370_COPY          =  10,
-  R_I370_RELATIVE      =  11,
-
-  R_I370_max
-};
-\f
 static reloc_howto_type *i370_elf_howto_table[ (int)R_I370_max ];
 
 static reloc_howto_type i370_elf_howto_raw[] =
@@ -257,7 +231,7 @@ static reloc_howto_type *i370_elf_reloc_type_lookup
   PARAMS ((bfd *, bfd_reloc_code_real_type));
 
 static void i370_elf_info_to_howto PARAMS ((bfd *abfd, arelent *cache_ptr,
-                                           Elf32_Internal_Rela *dst));
+                                           Elf_Internal_Rela *dst));
 static boolean i370_elf_set_private_flags PARAMS ((bfd *, flagword));
 \f
 /* Initialize the i370_elf_howto_table, so that linear accesses can be done.  */
@@ -318,10 +292,10 @@ static boolean i370_elf_create_dynamic_sections PARAMS ((bfd *,
                                                         struct bfd_link_info *));
 
 static boolean i370_elf_section_from_shdr PARAMS ((bfd *,
-                                                  Elf32_Internal_Shdr *,
-                                                  char *));
+                                                  Elf_Internal_Shdr *,
+                                                  const char *));
 static boolean i370_elf_fake_sections PARAMS ((bfd *,
-                                              Elf32_Internal_Shdr *,
+                                              Elf_Internal_Shdr *,
                                               asection *));
 #if 0
 static elf_linker_section_t *i370_elf_create_linker_section
@@ -354,7 +328,7 @@ static void
 i370_elf_info_to_howto (abfd, cache_ptr, dst)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
-     Elf32_Internal_Rela *dst;
+     Elf_Internal_Rela *dst;
 {
   if (!i370_elf_howto_table[ R_I370_ADDR31 ])  /* Initialize howto table */
     i370_elf_howto_init ();
@@ -428,8 +402,8 @@ i370_elf_merge_private_bfd_data (ibfd, obfd)
 static boolean
 i370_elf_section_from_shdr (abfd, hdr, name)
      bfd *abfd;
-     Elf32_Internal_Shdr *hdr;
-     char *name;
+     Elf_Internal_Shdr *hdr;
+     const char *name;
 {
   asection *newsect;
   flagword flags;
@@ -458,7 +432,7 @@ i370_elf_section_from_shdr (abfd, hdr, name)
 static boolean
 i370_elf_fake_sections (abfd, shdr, asect)
      bfd *abfd ATTRIBUTE_UNUSED;
-     Elf32_Internal_Shdr *shdr;
+     Elf_Internal_Shdr *shdr;
      asection *asect;
 {
   if ((asect->flags & SEC_EXCLUDE) != 0)
@@ -1414,6 +1388,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
              && r_symndx != 0)
            {
              Elf_Internal_Rela outrel;
+             bfd_byte *loc;
              int skip;
 
 #ifdef DEBUG
@@ -1519,11 +1494,9 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                    }
                }
 
-             bfd_elf32_swap_reloca_out (output_bfd, &outrel,
-                                        (((Elf32_External_Rela *)
-                                          sreloc->contents)
-                                         + sreloc->reloc_count));
-             ++sreloc->reloc_count;
+             loc = sreloc->contents;
+             loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+             bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
 
              /* This reloc will be computed at runtime, so there's no
                  need to do anything now, unless this is a RELATIVE