summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-11-23 14:04:18 +0000
committerDaniel Jacobowitz <drow@false.org>2005-11-23 14:04:18 +0000
commitbad36eacdad37042c4efb1c5fbf48476b47de82b (patch)
tree09ba18d0af929dc68344a1788a63c3d48f0613e7 /bfd
parenta14199dbd52888ecea9fc3d0e0f2c264c172f29c (diff)
downloadbinutils-gdb-bad36eacdad37042c4efb1c5fbf48476b47de82b.tar.gz
bfd/
* elf32-mips.c (elf_mips_howto_table_rel): Use rightshift 2 for R_MIPS_PC16. (mips_reloc_map): Map BFD_RELOC_16_PCREL_S2 to R_MIPS_PC16. (bfd_elf32_bfd_reloc_type_lookup): Don't handle BFD_RELOC_16_PCREL_S2. * elf64-mips.c (mips_elf64_howto_table_rel): Use rightshift 2 for R_MIPS_PC16. (mips_elf64_howto_table_rela): Likewise. (mips_reloc_map): Map BFD_RELOC_16_PCREL_S2 to R_MIPS_PC16. (bfd_elf64_bfd_reloc_type_lookup): Don't handle BFD_RELOC_16_PCREL_S2. * elfn32-mips.c (elf_mips_howto_table_rel): Use rightshift 2 for R_MIPS_PC16. (elf_mips_howto_table_rela): Likewise. (mips_reloc_map): Map BFD_RELOC_16_PCREL_S2 to R_MIPS_PC16. (bfd_elf32_bfd_reloc_type_lookup): Don't handle BFD_RELOC_16_PCREL_S2. * elfxx-mips.c: Formatting fixes. (mips_elf_calculate_relocation): Handle R_MIPS_GNU_REL16_S2 and R_MIPS_PC16 identically. gas/ * config/tc-mips.c (append_insn): Handle BFD_RELOC_16_PCREL_S2. (macro_build): Complain for invalid branch displacements. (mips_validate_fix): Delete. (md_apply_fix): Re-add pcrel support for branches. Use consistent text for misaligned branch targets. (tc_gen_reloc: Re-add pcrel support for branches. Handle strange BFD pcrel processing. Remove error for unresolved branches. * config/tc-mips.h (TC_VALIDATE_FIX, mips_validate_fix): Delete. gas/testsuite/ * gas/mips/bge.d, gas/mips/bge.s, gas/mips/bgeu.d, gas/mips/bgeu.s, gas/mips/blt.d, gas/mips/blt.s, gas/mips/bltu.d, gas/mips/bltu.s: Reactivate external branch tests. * gas/mips/branch-misc-2.d, gas/mips/branch-misc-2pic.d, gas/mips/branch-misc-2-64.d, gas/mips/branch-misc-2pic-64.d: New tests. * gas/mips/branch-misc-2.l, gas/mips/branch-misc-2pic.l, gas/testsuite/gas/mips/branch-misc-2pic.s: Remove. * gas/mips/mips.exp: Adjust branch-misc-2 tests. Add 64-bit variants.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog24
-rw-r--r--bfd/elf32-mips.c10
-rw-r--r--bfd/elf64-mips.c16
-rw-r--r--bfd/elfn32-mips.c16
-rw-r--r--bfd/elfxx-mips.c15
5 files changed, 52 insertions, 29 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 866466c76d9..6b78c6bc002 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,27 @@
+2005-11-23 Daniel Jacobowitz <dan@codesourcery.com>
+ Thiemo Seufer <ths@networkno.de>
+
+ * elf32-mips.c (elf_mips_howto_table_rel): Use rightshift 2 for
+ R_MIPS_PC16.
+ (mips_reloc_map): Map BFD_RELOC_16_PCREL_S2 to R_MIPS_PC16.
+ (bfd_elf32_bfd_reloc_type_lookup): Don't handle
+ BFD_RELOC_16_PCREL_S2.
+ * elf64-mips.c (mips_elf64_howto_table_rel): Use rightshift 2 for
+ R_MIPS_PC16.
+ (mips_elf64_howto_table_rela): Likewise.
+ (mips_reloc_map): Map BFD_RELOC_16_PCREL_S2 to R_MIPS_PC16.
+ (bfd_elf64_bfd_reloc_type_lookup): Don't handle
+ BFD_RELOC_16_PCREL_S2.
+ * elfn32-mips.c (elf_mips_howto_table_rel): Use rightshift 2 for
+ R_MIPS_PC16.
+ (elf_mips_howto_table_rela): Likewise.
+ (mips_reloc_map): Map BFD_RELOC_16_PCREL_S2 to R_MIPS_PC16.
+ (bfd_elf32_bfd_reloc_type_lookup): Don't handle
+ BFD_RELOC_16_PCREL_S2.
+ * elfxx-mips.c: Formatting fixes.
+ (mips_elf_calculate_relocation): Handle R_MIPS_GNU_REL16_S2
+ and R_MIPS_PC16 identically.
+
2005-11-23 Frederic Riss <frederic.riss@st.com>
* elfcode.h (elf_object_p): Delay the setting of start_address
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 9684d0bf854..3cdaeeec6d6 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -257,9 +257,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -1206,7 +1208,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
{ BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
{ BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
{ BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
- { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+ { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
{ BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
{ BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
{ BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
@@ -1283,8 +1285,6 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
return &elf_mips_gnu_vtinherit_howto;
case BFD_RELOC_VTABLE_ENTRY:
return &elf_mips_gnu_vtentry_howto;
- case BFD_RELOC_16_PCREL_S2:
- return &elf_mips_gnu_rel16_s2;
case BFD_RELOC_32_PCREL:
return &elf_mips_gnu_pcrel32;
}
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 7f0bb12e670..c8f3127e3c9 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -299,9 +299,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -948,9 +950,11 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -2133,7 +2137,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
/* There is no BFD reloc for R_MIPS_REL32. */
{ BFD_RELOC_64, R_MIPS_64 },
{ BFD_RELOC_CTOR, R_MIPS_64 },
- { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+ { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
{ BFD_RELOC_HI16_S, R_MIPS_HI16 },
{ BFD_RELOC_LO16, R_MIPS_LO16 },
{ BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
@@ -2217,8 +2221,6 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return &elf_mips_gnu_vtinherit_howto;
case BFD_RELOC_VTABLE_ENTRY:
return &elf_mips_gnu_vtentry_howto;
- case BFD_RELOC_16_PCREL_S2:
- return &elf_mips_gnu_rela16_s2;
default:
bfd_set_error (bfd_error_bad_value);
return NULL;
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index b4fafb7e41b..b1211f0c65e 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -262,9 +262,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -913,9 +915,11 @@ static reloc_howto_type elf_mips_howto_table_rela[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -1981,7 +1985,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
/* There is no BFD reloc for R_MIPS_REL32. */
{ BFD_RELOC_CTOR, R_MIPS_32 },
{ BFD_RELOC_64, R_MIPS_64 },
- { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+ { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
{ BFD_RELOC_HI16_S, R_MIPS_HI16 },
{ BFD_RELOC_LO16, R_MIPS_LO16 },
{ BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
@@ -2065,8 +2069,6 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return &elf_mips_gnu_vtinherit_howto;
case BFD_RELOC_VTABLE_ENTRY:
return &elf_mips_gnu_vtentry_howto;
- case BFD_RELOC_16_PCREL_S2:
- return &elf_mips_gnu_rela16_s2;
default:
bfd_set_error (bfd_error_bad_value);
return NULL;
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index d4b90de3c34..af8f3c79474 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -456,7 +456,6 @@ static struct mips_got_info *mips_elf_got_for_ibfd
static bfd *reldyn_sorting_bfd;
/* Nonzero if ABFD is using the N32 ABI. */
-
#define ABI_N32_P(abfd) \
((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
@@ -2762,7 +2761,7 @@ mips_elf_bfd2got_entry_eq (const void *entry1, const void *entry2)
return e1->bfd == e2->bfd;
}
-/* In a multi-got link, determine the GOT to be used for IBDF. G must
+/* In a multi-got link, determine the GOT to be used for IBFD. G must
be the master GOT data. */
static struct mips_got_info *
@@ -4035,12 +4034,6 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
value &= howto->dst_mask;
break;
- case R_MIPS_GNU_REL16_S2:
- value = symbol + _bfd_mips_elf_sign_extend (addend, 18) - p;
- overflowed_p = mips_elf_overflow_p (value, 18);
- value = (value >> 2) & howto->dst_mask;
- break;
-
case R_MIPS16_26:
/* The calculation for R_MIPS16_26 is just the same as for an
R_MIPS_26. It's only the storage of the relocated field into
@@ -4204,8 +4197,10 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
break;
case R_MIPS_PC16:
- value = _bfd_mips_elf_sign_extend (addend, 16) + symbol - p;
- overflowed_p = mips_elf_overflow_p (value, 16);
+ case R_MIPS_GNU_REL16_S2:
+ value = symbol + _bfd_mips_elf_sign_extend (addend, 18) - p;
+ overflowed_p = mips_elf_overflow_p (value, 18);
+ value = (value >> 2) & howto->dst_mask;
break;
case R_MIPS_GOT_HI16: