aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-08-06 02:44:41 +0000
committerMark Mitchell <mark@codesourcery.com>1999-08-06 02:44:41 +0000
commit4f2860cafc0c098d1c3f1227d4d5e0f2a652ee33 (patch)
tree2ef165b43042b5400f757146b8c39fa7104cb043 /bfd
parentfeb129926a8d12656f1ca4b7a8bb10268d3af4fb (diff)
downloadgdb-4f2860cafc0c098d1c3f1227d4d5e0f2a652ee33.zip
gdb-4f2860cafc0c098d1c3f1227d4d5e0f2a652ee33.tar.gz
gdb-4f2860cafc0c098d1c3f1227d4d5e0f2a652ee33.tar.bz2
* 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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-mips.c22
2 files changed, 21 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f76a888..cb37a17 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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>:
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 9b6e710..f0b8bec 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -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. */