OSDN Git Service

* Reverted 2003-03-02's patch.
authoraoliva <aoliva>
Wed, 12 Mar 2003 23:05:50 +0000 (23:05 +0000)
committeraoliva <aoliva>
Wed, 12 Mar 2003 23:05:50 +0000 (23:05 +0000)
bfd/ChangeLog
bfd/bfd-in2.h
bfd/elf32-mips.c
bfd/elf64-mips.c
bfd/elfn32-mips.c
bfd/elfxx-mips.c
bfd/libbfd.h
bfd/reloc.c

index b64fd70..f5ac676 100644 (file)
@@ -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,
index 9540eeb..2385c40 100644 (file)
@@ -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,
 
index cf705d5..1399f00 100644 (file)
@@ -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;
index 404504a..46d9a92 100644 (file)
@@ -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 },
index b2d745b..00a0e88 100644 (file)
@@ -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 },
index 420a951..2b2f615 100644 (file)
@@ -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:
index 14978ba..222b23d 100644 (file)
@@ -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",
index 45660c8..9f8a952 100644 (file)
@@ -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.