include/elf/ChangeLog
[deliverable/binutils-gdb.git] / bfd / elf32-cris.c
index dfbdbe75f683c0569ad38f2a718c6f98fa979f21..8db111504da4a1b92fe25bff8dc08f1646f927e6 100644 (file)
@@ -31,7 +31,7 @@ static reloc_howto_type * cris_reloc_type_lookup
   PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
 
 static void cris_info_to_howto_rela
-  PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+  PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
 
 static boolean cris_elf_grok_prstatus
   PARAMS ((bfd *abfd, Elf_Internal_Note *note));
@@ -458,7 +458,7 @@ static void
 cris_info_to_howto_rela (abfd, cache_ptr, dst)
      bfd * abfd ATTRIBUTE_UNUSED;
      arelent * cache_ptr;
-     Elf32_Internal_Rela * dst;
+     Elf_Internal_Rela * dst;
 {
   unsigned int r_type;
 
@@ -1079,22 +1079,21 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
                    if (info->shared)
                      {
-                       asection *srelgot;
+                       asection *s;
                        Elf_Internal_Rela outrel;
+                       bfd_byte *loc;
 
-                       srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
-                       BFD_ASSERT (srelgot != NULL);
+                       s = bfd_get_section_by_name (dynobj, ".rela.got");
+                       BFD_ASSERT (s != NULL);
 
                        outrel.r_offset = (sgot->output_section->vma
                                           + sgot->output_offset
                                           + off);
                        outrel.r_info = ELF32_R_INFO (0, R_CRIS_RELATIVE);
                        outrel.r_addend = relocation;
-                       bfd_elf32_swap_reloca_out (output_bfd, &outrel,
-                                                  (((Elf32_External_Rela *)
-                                                    srelgot->contents)
-                                                   + srelgot->reloc_count));
-                       ++srelgot->reloc_count;
+                       loc = s->contents;
+                       loc += s->reloc_count++ * sizeof (Elf32_External_Rela);
+                       bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
                      }
 
                    local_got_offsets[r_symndx] |= 1;
@@ -1237,6 +1236,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                          & ELF_LINK_HASH_DEF_REGULAR) == 0)))
            {
              Elf_Internal_Rela outrel;
+             bfd_byte *loc;
              boolean skip, relocate;
 
              /* When generating a shared object, these relocations
@@ -1345,11 +1345,9 @@ cris_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, except for R_CRIS_32 relocations
@@ -1437,6 +1435,7 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
       bfd_vma gotplt_offset
        = ((struct elf_cris_link_hash_entry *) h)->gotplt_offset;
       Elf_Internal_Rela rela;
+      bfd_byte *loc;
       boolean has_gotplt = gotplt_offset != 0;
 
       /* Get the index in the procedure linkage table which
@@ -1517,9 +1516,8 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
                           + got_offset);
          rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_JUMP_SLOT);
          rela.r_addend = 0;
-         bfd_elf32_swap_reloca_out (output_bfd, &rela,
-                                    ((Elf32_External_Rela *) srela->contents
-                                     + gotplt_index));
+         loc = srela->contents + gotplt_index * sizeof (Elf32_External_Rela);
+         bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
        }
 
       if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
@@ -1554,6 +1552,7 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
       asection *sgot;
       asection *srela;
       Elf_Internal_Rela rela;
+      bfd_byte *loc;
       bfd_byte *where;
 
       /* This symbol has an entry in the global offset table.  Set it up.  */
@@ -1587,16 +1586,16 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
          rela.r_addend = 0;
        }
 
-      bfd_elf32_swap_reloca_out (output_bfd, &rela,
-                                ((Elf32_External_Rela *) srela->contents
-                                 + srela->reloc_count));
-      ++srela->reloc_count;
+      loc = srela->contents;
+      loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
+      bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
     }
 
   if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
     {
       asection *s;
       Elf_Internal_Rela rela;
+      bfd_byte *loc;
 
       /* This symbol needs a copy reloc.  Set it up.  */
 
@@ -1613,10 +1612,8 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
                       + h->root.u.def.section->output_offset);
       rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_COPY);
       rela.r_addend = 0;
-      bfd_elf32_swap_reloca_out (output_bfd, &rela,
-                                ((Elf32_External_Rela *) s->contents
-                                 + s->reloc_count));
-      ++s->reloc_count;
+      loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+      bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
This page took 0.025101 seconds and 4 git commands to generate.