This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
d10v: complain on branch overflows
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: 29 Nov 2001 15:41:46 -0200
- Subject: d10v: complain on branch overflows
- Organization: GCC Team, Red Hat
The d10v linker would sometimes fail to report an overflow in a
branch, when the operand would fit in an unsigned integer with the
given bitsize, even though the field is signed, and narrower than
specified.
This patch fixes this problem, by getting these fields checked for
overflow as signed, not as bitfields, fixes the actual width of the
bitfields that are shifted right by 2 bits, adjusts formatting and
disables some pointless overflow checking (_NONE and _32).
Ok to install?
Index: bfd/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* elf32-d10v.c (elf_d10v_howto_table): Adjust bit-size of
R_D10V_10_PCREL_L, R_D10V_10_PCREL_R, R_D10V_18,
R_D10V_18_PCREL. Check 10_PCREL relocations as signed.
Disable pointless overflow checking of NONE and 32.
Index: bfd/elf32-d10v.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-d10v.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf32-d10v.c
--- bfd/elf32-d10v.c 2001/11/23 12:17:15 1.11
+++ bfd/elf32-d10v.c 2001/11/29 17:31:19
@@ -52,12 +52,12 @@ static reloc_howto_type elf_d10v_howto_t
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_D10V_NONE", /* name */
- false, /* partial_inplace */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_D10V_NONE", /* name */
+ false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
false), /* pcrel_offset */
@@ -67,44 +67,44 @@ static reloc_howto_type elf_d10v_howto_t
HOWTO (R_D10V_10_PCREL_R, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 10, /* bitsize */
- true, /* pc_relative */
+ 8, /* bitsize */
+ true, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_D10V_10_PCREL_R", /* name */
- false, /* partial_inplace */
- 0xff, /* src_mask */
+ false, /* partial_inplace */
+ 0xff, /* src_mask */
0xff, /* dst_mask */
- true), /* pcrel_offset */
+ true), /* pcrel_offset */
/* An PC Relative 10-bit relocation, shifted by 2 */
/* left container */
HOWTO (R_D10V_10_PCREL_L, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 10, /* bitsize */
- true, /* pc_relative */
+ 8, /* bitsize */
+ true, /* pc_relative */
15, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_D10V_10_PCREL_L", /* name */
- false, /* partial_inplace */
- 0x07f8000, /* src_mask */
- 0x07f8000, /* dst_mask */
- true), /* pcrel_offset */
+ false, /* partial_inplace */
+ 0x07f8000, /* src_mask */
+ 0x07f8000, /* dst_mask */
+ true), /* pcrel_offset */
/* A 16 bit absolute relocation */
HOWTO (R_D10V_16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_D10V_16", /* name */
- false, /* partial_inplace */
+ false, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
@@ -113,13 +113,13 @@ static reloc_howto_type elf_d10v_howto_t
HOWTO (R_D10V_18, /* type */
2, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 18, /* bitsize */
- false, /* pc_relative */
+ 16, /* bitsize */
+ false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_D10V_18", /* name */
- false, /* partial_inplace */
+ false, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
@@ -128,13 +128,13 @@ static reloc_howto_type elf_d10v_howto_t
HOWTO (R_D10V_18_PCREL, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 18, /* bitsize */
- true, /* pc_relative */
+ 16, /* bitsize */
+ true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_D10V_18_PCREL", /* name */
- false, /* partial_inplace */
+ false, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
true), /* pcrel_offset */
@@ -144,12 +144,12 @@ static reloc_howto_type elf_d10v_howto_t
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
"R_D10V_32", /* name */
- false, /* partial_inplace */
+ false, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me