* elf32-mips.c (mips_elf_got16_entry): Don't multiply GOT index by
authorMark Mitchell <mark@codesourcery.com>
Fri, 6 Aug 1999 02:44:41 +0000 (02:44 +0000)
committerMark Mitchell <mark@codesourcery.com>
Fri, 6 Aug 1999 02:44:41 +0000 (02:44 +0000)
the size of a GOT entry here.
(mips_elf_calculate_relocation): Don't create a local GOT entry
for the symbol in a GOT16 relocation; just for it's high-order bit
(_bfd_mips_elf_relocate_section): Fix thinko.

bfd/ChangeLog
bfd/elf32-mips.c

index f76a888aa74dd67b04049781b1dd117edb64e7b9..cb37a17c44ac858058a15e2afd0fa0d97ce7d403 100644 (file)
@@ -1,3 +1,11 @@
+1999-08-04  Mark Mitchell  <mark@codesourcery.com>
+
+       * elf32-mips.c (mips_elf_got16_entry): Don't multiply GOT index by
+       the size of a GOT entry here.
+       (mips_elf_calculate_relocation): Don't create a local GOT entry
+       for the symbol in a GOT16 relocation; just for it's high-order bit
+       (_bfd_mips_elf_relocate_section): Fix thinko.
+
 1999-08-05  Ian Lance Taylor  <ian@zembu.com>
 
        Based on patches from Donn Terry <donn@interix.com>:
index 9b6e710f5caf820d29e4b3239784d4a238296d3b..f0b8bec2cb14bb14cf94bc1097b5ee7fb93b89f7 100644 (file)
@@ -5551,7 +5551,7 @@ mips_elf_got16_entry (abfd, info, value)
       if ((address & 0xffff0000) == value)
        {
          /* This entry has the right high-order 16 bits.  */
-         index = MIPS_ELF_GOT_SIZE (abfd) * (entry - sgot->contents);
+         index = entry - sgot->contents;
          break;
        }
     }
@@ -5971,13 +5971,17 @@ mips_elf_calculate_relocation (abfd,
     case R_MIPS_GOT_LO16:
     case R_MIPS_CALL_LO16:
       /* Find the index into the GOT where this value is located.  */
-      if (h)
+      if (!local_p)
        {
          BFD_ASSERT (addend == 0);
          g = mips_elf_global_got_index 
            (elf_hash_table (info)->dynobj,
             (struct elf_link_hash_entry*) h);
        }
+      else if (r_type == R_MIPS_GOT16)
+       /* There's no need to create a local GOT entry here; the
+          calculation for a local GOT16 entry does not involve G.  */
+       break;
       else
        {
          g = mips_elf_local_got_index (abfd, info, symbol + addend);
@@ -6599,24 +6603,24 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            /* There's nothing to do for non-local relocations.  */
            continue;
 
-         r_symndx = ELF32_R_SYM (rel->r_info);
-         sym = local_syms + r_symndx;
-         if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
-           /* Adjust the addend appropriately.  */
-           addend += local_sections[r_symndx]->output_offset;
-         
          if (r_type == R_MIPS16_GPREL 
              || r_type == R_MIPS_GPREL16
              || r_type == R_MIPS_GPREL32)
            addend -= (_bfd_get_gp_value (output_bfd)
                       - _bfd_get_gp_value (input_bfd));
-         else if (r_type == R_MIPS16_26 || r_type == R_MIPS16_26)
+         else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26)
            /* The addend is stored without its two least
               significant bits (which are always zero.)  In a
               non-relocateable link, calculate_relocation will do
               this shift; here, we must do it ourselves.  */
            addend <<= 2;
 
+         r_symndx = ELF32_R_SYM (rel->r_info);
+         sym = local_syms + r_symndx;
+         if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+           /* Adjust the addend appropriately.  */
+           addend += local_sections[r_symndx]->output_offset;
+         
          /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16,
             then we only want to write out the high-order 16 bits.
             The subsequent R_MIPS_LO16 will handle the low-order bits.  */
This page took 0.03175 seconds and 4 git commands to generate.