* elfxx-mips.c (MIPS_RELOC_RELA_P): New macro.
authorAlexandre Oliva <aoliva@redhat.com>
Tue, 19 Nov 2002 20:52:32 +0000 (20:52 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Tue, 19 Nov 2002 20:52:32 +0000 (20:52 +0000)
(_bfd_mips_elf_relocate_section): Use it.

bfd/ChangeLog
bfd/elfxx-mips.c

index af23d387b61fc6e52bd053c82847e78a32e13636..561ff1141342c5febac4b32146e5d91fe070fe98 100644 (file)
@@ -1,5 +1,8 @@
 2002-11-19  Alexandre Oliva  <aoliva@redhat.com>
 
+       * elfxx-mips.c (MIPS_RELOC_RELA_P): New macro.
+       (_bfd_mips_elf_relocate_section): Use it.
+
        * elfxx-mips.c (MNAME): New macro.
        (_bfd_mips_elf_check_relocs): Use it.
        (_bfd_mips_elf_discard_info): Likewise.
index 2b27f5671aaa2ae42e3481caffb022ea5ce5e06d..98dfdd8547814a7d5bc3bd584a2a409904b70b4d 100644 (file)
@@ -443,6 +443,23 @@ static bfd *reldyn_sorting_bfd;
 #define MIPS_ELF_RTYPE_TO_HOWTO(abfd, rtype, rela)                     \
   (get_elf_backend_data (abfd)->elf_backend_mips_rtype_to_howto (rtype, rela))
 
+/* Determine whether the internal relocation of index REL_IDX is REL
+   (zero) or RELA (non-zero).  The assumption is that, if there are
+   two relocation sections for this section, one of them is REL and
+   the other is RELA.  If the index of the relocation we're testing is
+   in range for the first relocation section, check that the external
+   relocation size is that for RELA.  It is also assumed that, if
+   rel_idx is not in range for the first section, and this first
+   section contains REL relocs, then the relocation is in the second
+   section, that is RELA.  */
+#define MIPS_RELOC_RELA_P(abfd, sec, rel_idx)                          \
+  ((NUM_SHDR_ENTRIES (&elf_section_data (sec)->rel_hdr)                        \
+    * get_elf_backend_data (abfd)->s->int_rels_per_ext_rel             \
+    > (bfd_vma)(rel_idx))                                              \
+   == (elf_section_data (sec)->rel_hdr.sh_entsize                      \
+       == (ABI_64_P (abfd) ? sizeof (Elf64_External_Rela)              \
+          : sizeof (Elf32_External_Rela))))
+
 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
    from smaller values.  Start with zero, widen, *then* decrement.  */
 #define MINUS_ONE      (((bfd_vma)0) - 1)
@@ -5044,7 +5061,10 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
       else
        /* NewABI defaults to RELA relocations.  */
        howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, r_type,
-                                        NEWABI_P (input_bfd));
+                                        NEWABI_P (input_bfd)
+                                        && (MIPS_RELOC_RELA_P
+                                            (input_bfd, input_section,
+                                             rel - relocs)));
 
       if (!use_saved_addend_p)
        {
This page took 0.034198 seconds and 4 git commands to generate.