mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-28 23:39:35 +08:00
* reloc.c (bfd_check_overflow): Add casts before shifts which may
not fit in 32 bits. (_bfd_relocate_contents): Likewise.
This commit is contained in:
@ -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>
|
Mon May 18 14:44:15 1998 Nick Clifton <nickc@cygnus.com>
|
||||||
|
|
||||||
* peicode.h (add_data_entry): If the section has no private data
|
* peicode.h (add_data_entry): If the section has no private data
|
||||||
|
27
bfd/reloc.c
27
bfd/reloc.c
@ -1,5 +1,5 @@
|
|||||||
/* BFD support for handling relocation entries.
|
/* 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.
|
Free Software Foundation, Inc.
|
||||||
Written by Cygnus Support.
|
Written by Cygnus Support.
|
||||||
|
|
||||||
@ -411,14 +411,14 @@ FUNCTION
|
|||||||
bfd_get_reloc_size
|
bfd_get_reloc_size
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
int bfd_get_reloc_size (reloc_howto_type *);
|
unsigned int bfd_get_reloc_size (reloc_howto_type *);
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
For a reloc_howto_type that operates on a fixed number of bytes,
|
For a reloc_howto_type that operates on a fixed number of bytes,
|
||||||
this returns the number of bytes operated on.
|
this returns the number of bytes operated on.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
unsigned int
|
||||||
bfd_get_reloc_size (howto)
|
bfd_get_reloc_size (howto)
|
||||||
reloc_howto_type *howto;
|
reloc_howto_type *howto;
|
||||||
{
|
{
|
||||||
@ -492,7 +492,8 @@ bfd_check_overflow (how, bitsize, rightshift, relocation)
|
|||||||
case complain_overflow_signed:
|
case complain_overflow_signed:
|
||||||
{
|
{
|
||||||
/* Assumes two's complement. */
|
/* 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;
|
bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
|
||||||
|
|
||||||
/* The above right shift is incorrect for a signed value.
|
/* 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
|
/* Assumes two's complement. This expression avoids
|
||||||
overflow if `bitsize' is the number of bits in
|
overflow if `bitsize' is the number of bits in
|
||||||
bfd_vma. */
|
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)
|
if ((bfd_vma) check > reloc_unsigned_max)
|
||||||
flag = bfd_reloc_overflow;
|
flag = bfd_reloc_overflow;
|
||||||
@ -1523,7 +1525,8 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
|
|||||||
case complain_overflow_signed:
|
case complain_overflow_signed:
|
||||||
{
|
{
|
||||||
/* Assumes two's complement. */
|
/* 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;
|
bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
|
||||||
|
|
||||||
if (signed_check > 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
|
overflow if howto->bitsize is the number of bits in
|
||||||
bfd_vma. */
|
bfd_vma. */
|
||||||
bfd_vma reloc_unsigned_max =
|
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)
|
if (check > reloc_unsigned_max)
|
||||||
overflow = true;
|
overflow = true;
|
||||||
@ -2007,6 +2010,12 @@ ENUMX
|
|||||||
BFD_RELOC_MIPS_CALL_HI16
|
BFD_RELOC_MIPS_CALL_HI16
|
||||||
ENUMX
|
ENUMX
|
||||||
BFD_RELOC_MIPS_CALL_LO16
|
BFD_RELOC_MIPS_CALL_LO16
|
||||||
|
COMMENT
|
||||||
|
{* start-sanitize-r5900 *}
|
||||||
|
ENUMX
|
||||||
|
BFD_RELOC_MIPS15_S3
|
||||||
|
COMMENT
|
||||||
|
{* end-sanitize-r5900 *}
|
||||||
ENUMDOC
|
ENUMDOC
|
||||||
MIPS ELF relocations.
|
MIPS ELF relocations.
|
||||||
|
|
||||||
@ -2018,6 +2027,10 @@ ENUMDOC
|
|||||||
MIPS DVP Relocations.
|
MIPS DVP Relocations.
|
||||||
This is an 11-bit pc relative reloc. The recorded address is for the
|
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.
|
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
|
COMMENT
|
||||||
{* end-sanitize-sky *}
|
{* end-sanitize-sky *}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user