aboutsummaryrefslogtreecommitdiff
path: root/bfd/reloc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-02-21 22:24:03 +0000
committerAlan Modra <amodra@gmail.com>2010-02-21 22:24:03 +0000
commit263badd715709e7ecfe7fdf4aa39d1c517a923e6 (patch)
treea84d890dc41d7224a74606021953e8bf5c5e8c9e /bfd/reloc.c
parentb487ad64e5aa3da0c80b8648f7079b5415c45a3a (diff)
downloadgdb-263badd715709e7ecfe7fdf4aa39d1c517a923e6.zip
gdb-263badd715709e7ecfe7fdf4aa39d1c517a923e6.tar.gz
gdb-263badd715709e7ecfe7fdf4aa39d1c517a923e6.tar.bz2
* reloc.c (bfd_check_overflow): When forming addrmask, shift
fieldmask left by rightshift. (_bfd_relocate_contents): Likewise. Use rightshift addrmask in all overflow checks.
Diffstat (limited to 'bfd/reloc.c')
-rw-r--r--bfd/reloc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/bfd/reloc.c b/bfd/reloc.c
index dca56d9..0249662 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1,6 +1,6 @@
/* BFD support for handling relocation entries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -504,7 +504,7 @@ bfd_check_overflow (enum complain_overflow how,
overflow check. */
fieldmask = N_ONES (bitsize);
signmask = ~fieldmask;
- addrmask = N_ONES (addrsize) | fieldmask;
+ addrmask = N_ONES (addrsize) | (fieldmask << rightshift);
a = (relocation & addrmask) >> rightshift;;
switch (how)
@@ -1434,9 +1434,11 @@ _bfd_relocate_contents (reloc_howto_type *howto,
See also bfd_check_overflow. */
fieldmask = N_ONES (howto->bitsize);
signmask = ~fieldmask;
- addrmask = N_ONES (bfd_arch_bits_per_address (input_bfd)) | fieldmask;
+ addrmask = (N_ONES (bfd_arch_bits_per_address (input_bfd))
+ | (fieldmask << rightshift));
a = (relocation & addrmask) >> rightshift;
b = (x & howto->src_mask & addrmask) >> bitpos;
+ addrmask >>= rightshift;
switch (howto->complain_on_overflow)
{
@@ -1454,7 +1456,7 @@ _bfd_relocate_contents (reloc_howto_type *howto,
field. Note that when bfd_vma is 32 bits, a 32-bit reloc
can't overflow, which is exactly what we want. */
ss = a & signmask;
- if (ss != 0 && ss != ((addrmask >> rightshift) & signmask))
+ if (ss != 0 && ss != (addrmask & signmask))
flag = bfd_reloc_overflow;
/* We only need this next bit of code if the sign bit of B
@@ -2023,6 +2025,10 @@ ENUMX
BFD_RELOC_SPU_PPU64
ENUMX
BFD_RELOC_SPU_ADD_PIC
+ENUMX
+ BFD_RELOC_SPU_PIC18
+ENUMX
+ BFD_RELOC_SPU_STUB
ENUMDOC
SPU Relocations.