Catch overflow in 22_PCREL reloc.
authorNick Clifton <nickc@redhat.com>
Tue, 22 Jun 1999 02:41:43 +0000 (02:41 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 22 Jun 1999 02:41:43 +0000 (02:41 +0000)
bfd/ChangeLog
bfd/elf32-v850.c

index 8471a7e721e6bcfbae31546853bb371468c91181..ff2cfdfdba28d9b2e68476bdb7ddd62d2ead1eb7 100644 (file)
@@ -1,3 +1,8 @@
+1999-06-22  Nick Clifton  <nickc@cygnus.com>
+
+       * elf32-v850.c (v850_elf_final_link_relocate): Catch overflow
+       handling R_V850_22_PCREL relocation.
+
 1999-06-21  Ian Lance Taylor  <ian@zembu.com>
 
        * coff-arm.c (arm_emit_base_file_entry): Explicitly declare return
index 08d4b75c23447b64219837f461dc0a6202502fcc..4ca60e8083b381731356c2e61857ae4e4e87793e 100644 (file)
@@ -1369,6 +1369,10 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
                + input_section->output_offset
                + offset);
 
+      /* If the sign extension will corrupt the value then we have overflowed.  */
+      if (((value & 0xff000000) != 0x0) && ((value & 0xff000000) != 0xff000000))
+       return bfd_reloc_overflow;
+      
       value = SEXT24 (value);  /* Only the bottom 24 bits of the PC are valid */
       break;