summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2003-03-12 23:05:51 +0000
committerAlexandre Oliva <aoliva@redhat.com>2003-03-12 23:05:51 +0000
commited433d72fa631b05dde94e668e8977ea1a5879f3 (patch)
tree236ce99027fcf9991a8d71c889a3201bb6b3e32d
parent6d2b2087ea0e89fb5388b0398faff16d4420e919 (diff)
downloadgdb-ed433d72fa631b05dde94e668e8977ea1a5879f3.tar.gz
* Reverted 2003-03-02's patch.
-rw-r--r--bfd/ChangeLog2
-rw-r--r--bfd/bfd-in2.h3
-rw-r--r--bfd/elf32-mips.c10
-rw-r--r--bfd/elf64-mips.c14
-rw-r--r--bfd/elfn32-mips.c14
-rw-r--r--bfd/elfxx-mips.c15
-rw-r--r--bfd/libbfd.h1
-rw-r--r--bfd/reloc.c6
8 files changed, 28 insertions, 37 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b64fd709631..f5ac6762d0f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,7 @@
2003-03-12 Alexandre Oliva <aoliva@redhat.com>
+ * Reverted 2003-03-02's patch.
+
* elfxx-target.h (bfd_elfNN_canonicalize_reloc): Make it
overridable.
* elf64-mips.c (mips_elf64_canonicalize_reloc,
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 9540eeb26a2..2385c409a5c 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2331,9 +2331,6 @@ to compensate for the borrow when the low bits are added. */
/* Like BFD_RELOC_LO16, but PC relative. */
BFD_RELOC_PCREL_LO16,
-/* Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC. */
- BFD_RELOC_MIPSEMB_16_PCREL_S2,
-
/* Relocation against a MIPS literal section. */
BFD_RELOC_MIPS_LITERAL,
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index cf705d502f0..1399f003128 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -261,11 +261,9 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 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. */
+ /* 16 bit PC relative reference. */
HOWTO (R_MIPS_PC16, /* type */
- 2, /* rightshift */
+ 0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -1403,7 +1401,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_S2, R_MIPS_PC16 },
+ { BFD_RELOC_16_PCREL, 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 },
@@ -1460,7 +1458,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
return &elf_mips_gnu_rel_hi16;
case BFD_RELOC_PCREL_LO16:
return &elf_mips_gnu_rel_lo16;
- case BFD_RELOC_MIPSEMB_16_PCREL_S2:
+ case BFD_RELOC_16_PCREL_S2:
return &elf_mips_gnu_rel16_s2;
case BFD_RELOC_64_PCREL:
return &elf_mips_gnu_pcrel64;
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 404504ae3d6..46d9a92cb5b 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -306,11 +306,9 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 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. */
+ /* 16 bit PC relative reference. */
HOWTO (R_MIPS_PC16, /* type */
- 2, /* rightshift */
+ 0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -803,11 +801,9 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 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. */
+ /* 16 bit PC relative reference. */
HOWTO (R_MIPS_PC16, /* type */
- 2, /* rightshift */
+ 0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -1904,7 +1900,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_S2, R_MIPS_PC16 },
+ { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
{ BFD_RELOC_HI16_S, R_MIPS_HI16 },
{ BFD_RELOC_LO16, R_MIPS_LO16 },
{ BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index b2d745bdfbc..00a0e88c1ce 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -275,11 +275,9 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 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. */
+ /* 16 bit PC relative reference. */
HOWTO (R_MIPS_PC16, /* type */
- 2, /* rightshift */
+ 0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -774,11 +772,9 @@ static reloc_howto_type elf_mips_howto_table_rela[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 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. */
+ /* 16 bit PC relative reference. */
HOWTO (R_MIPS_PC16, /* type */
- 2, /* rightshift */
+ 0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -1841,7 +1837,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_S2, R_MIPS_PC16 },
+ { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
{ BFD_RELOC_HI16_S, R_MIPS_HI16 },
{ BFD_RELOC_LO16, R_MIPS_LO16 },
{ BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 420a951d719..2b2f615934a 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -496,6 +496,7 @@ 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)
@@ -2129,7 +2130,7 @@ mips_elf_bfd2got_entry_eq (entry1, entry2)
return e1->bfd == e2->bfd;
}
-/* In a multi-got link, determine the GOT to be used for IBFD. G must
+/* In a multi-got link, determine the GOT to be used for IBDF. G must
be the master GOT data. */
static struct mips_got_info *
@@ -3315,6 +3316,12 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info,
value &= howto->dst_mask;
break;
+ case R_MIPS_GNU_REL16_S2:
+ value = symbol + mips_elf_sign_extend (addend << 2, 18) - p;
+ overflowed_p = mips_elf_overflow_p (value, 18);
+ value = (value >> 2) & howto->dst_mask;
+ break;
+
case R_MIPS_GNU_REL_HI16:
/* Instead of subtracting 'p' here, we should be subtracting the
equivalent value for the LO part of the reloc, since the value
@@ -3443,10 +3450,8 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info,
break;
case R_MIPS_PC16:
- case R_MIPS_GNU_REL16_S2:
- value = mips_elf_sign_extend (addend << 2, 18) + symbol - p;
- overflowed_p = mips_elf_overflow_p (value, 18);
- value = (value >> 2) & howto->dst_mask;
+ value = mips_elf_sign_extend (addend, 16) + symbol - p;
+ overflowed_p = mips_elf_overflow_p (value, 16);
break;
case R_MIPS_GOT_HI16:
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 14978ba862f..222b23dcb5d 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -850,7 +850,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_LO16",
"BFD_RELOC_PCREL_HI16_S",
"BFD_RELOC_PCREL_LO16",
- "BFD_RELOC_MIPSEMB_16_PCREL_S2",
"BFD_RELOC_MIPS_LITERAL",
"BFD_RELOC_MIPS_GOT16",
"BFD_RELOC_MIPS_CALL16",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 45660c8387e..9f8a952c591 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -2080,10 +2080,7 @@ ENUM
BFD_RELOC_PCREL_LO16
ENUMDOC
Like BFD_RELOC_LO16, but PC relative.
-ENUM
- BFD_RELOC_MIPSEMB_16_PCREL_S2
-ENUMDOC
- Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC.
+
ENUM
BFD_RELOC_MIPS_LITERAL
ENUMDOC
@@ -2153,6 +2150,7 @@ ENUMX
ENUMDOC
Fujitsu Frv Relocations.
COMMENT
+COMMENT
ENUMDOC
MIPS ELF relocations.