diff options
author | Ian Lance Taylor <ian@airs.com> | 1998-05-19 22:45:38 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1998-05-19 22:45:38 +0000 |
commit | 71842815b0221d8a03c41fff2d87dd24f1eead18 (patch) | |
tree | cac7cd129db09ce67c9cc6a0a67b82128b740f6a /bfd | |
parent | 200b86ea4f8fbd4be51a5ec7cc9058f71ad69a04 (diff) | |
download | gdb-71842815b0221d8a03c41fff2d87dd24f1eead18.zip gdb-71842815b0221d8a03c41fff2d87dd24f1eead18.tar.gz gdb-71842815b0221d8a03c41fff2d87dd24f1eead18.tar.bz2 |
* reloc.c (bfd_check_overflow): Add casts before shifts which may
not fit in 32 bits.
(_bfd_relocate_contents): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/reloc.c | 27 |
2 files changed, 28 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f39fc9d..2585373 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +Tue May 19 18:41:19 1998 Ian Lance Taylor <ian@cygnus.com> + + * bfd-in.h: Move over patch to bfd-in2.h. + + * reloc.c (bfd_check_overflow): Add casts before shifts which may + not fit in 32 bits. + (_bfd_relocate_contents): Likewise. + Mon May 18 14:44:15 1998 Nick Clifton <nickc@cygnus.com> * peicode.h (add_data_entry): If the section has no private data diff --git a/bfd/reloc.c b/bfd/reloc.c index 68fe459..1bdf307 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -1,5 +1,5 @@ /* BFD support for handling relocation entries. - Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997, 1998 + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. Written by Cygnus Support. @@ -411,14 +411,14 @@ FUNCTION bfd_get_reloc_size SYNOPSIS - int bfd_get_reloc_size (reloc_howto_type *); + unsigned int bfd_get_reloc_size (reloc_howto_type *); DESCRIPTION For a reloc_howto_type that operates on a fixed number of bytes, this returns the number of bytes operated on. */ -int +unsigned int bfd_get_reloc_size (howto) reloc_howto_type *howto; { @@ -492,7 +492,8 @@ bfd_check_overflow (how, bitsize, rightshift, relocation) case complain_overflow_signed: { /* Assumes two's complement. */ - bfd_signed_vma reloc_signed_max = (1 << (bitsize - 1)) - 1; + bfd_signed_vma reloc_signed_max = + ((bfd_signed_vma) 1 << (bitsize - 1)) - 1; bfd_signed_vma reloc_signed_min = ~reloc_signed_max; /* The above right shift is incorrect for a signed value. @@ -513,7 +514,8 @@ bfd_check_overflow (how, bitsize, rightshift, relocation) /* Assumes two's complement. This expression avoids overflow if `bitsize' is the number of bits in bfd_vma. */ - bfd_vma reloc_unsigned_max = (((1 << (bitsize - 1)) - 1) << 1) | 1; + bfd_vma reloc_unsigned_max = + ((((bfd_vma) 1 << (bitsize - 1)) - 1) << 1) | 1; if ((bfd_vma) check > reloc_unsigned_max) flag = bfd_reloc_overflow; @@ -1523,7 +1525,8 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location) case complain_overflow_signed: { /* Assumes two's complement. */ - bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; + bfd_signed_vma reloc_signed_max = + ((bfd_signed_vma) 1 << (howto->bitsize - 1)) - 1; bfd_signed_vma reloc_signed_min = ~reloc_signed_max; if (signed_check > reloc_signed_max @@ -1537,7 +1540,7 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location) overflow if howto->bitsize is the number of bits in bfd_vma. */ bfd_vma reloc_unsigned_max = - (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; + ((((bfd_vma) 1 << (howto->bitsize - 1)) - 1) << 1) | 1; if (check > reloc_unsigned_max) overflow = true; @@ -2007,6 +2010,12 @@ ENUMX BFD_RELOC_MIPS_CALL_HI16 ENUMX BFD_RELOC_MIPS_CALL_LO16 +COMMENT +{* start-sanitize-r5900 *} +ENUMX + BFD_RELOC_MIPS15_S3 +COMMENT +{* end-sanitize-r5900 *} ENUMDOC MIPS ELF relocations. @@ -2018,6 +2027,10 @@ ENUMDOC MIPS DVP Relocations. This is an 11-bit pc relative reloc. The recorded address is for the lower instruction word, and the value is in 128 bit units. +ENUM + BFD_RELOC_MIPS_DVP_27_S4 +ENUMDOC + This is a 27 bit address left shifted by 4. COMMENT {* end-sanitize-sky *} |