From: Nick Clifton Date: Tue, 22 Jun 1999 02:41:43 +0000 (+0000) Subject: Catch overflow in 22_PCREL reloc. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=232fb1a3f6e27a28b1f011564322f7b4d3b47248;p=binutils-gdb.git Catch overflow in 22_PCREL reloc. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8471a7e721e..ff2cfdfdba2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +1999-06-22 Nick Clifton + + * elf32-v850.c (v850_elf_final_link_relocate): Catch overflow + handling R_V850_22_PCREL relocation. + 1999-06-21 Ian Lance Taylor * coff-arm.c (arm_emit_base_file_entry): Explicitly declare return diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 08d4b75c234..4ca60e8083b 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -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;