This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: ld/1567: 64-bit vma overflow signalled from 32-bit-target address-wrap
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Cc: hp at axis dot com
- Date: Fri, 28 Oct 2005 09:37:15 -0700
- Subject: PATCH: ld/1567: 64-bit vma overflow signalled from 32-bit-target address-wrap
I don't think
http://sourceware.org/ml/binutils/2005-10/msg00427.html
is correct. complain_overflow_bitfield will fail for all 32bit targets
with 32bit RELA relocations when 64bit bfd_vma is used.
_bfd_relocate_contents has support for 32bit REL relocations, but not
RELA relocations. This patch should work.
H.J.
---
2005-10-28 H.J. Lu <hongjiu.lu@intel.com>
PR ld/1567
* elf32-cris.c (cris_elf_howto_table) <R_CRIS_32>: Undo the
last change.
* reloc.c (_bfd_relocate_contents): Support 32bit target with
64bit bfd_vma when checking complain_overflow_bitfield.
--- bfd/elf32-cris.c.overflow 2005-10-28 08:26:08.000000000 -0700
+++ bfd/elf32-cris.c 2005-10-28 08:34:08.000000000 -0700
@@ -156,12 +156,7 @@ static reloc_howto_type cris_elf_howto_t
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
- /* We don't want overflow complaints for 64-bit vma builds
- for e.g. sym+0x40000000 (or actually sym-0xc0000000 in
- 32-bit ELF) where sym=0xc0001234.
- Don't do this for the PIC relocs, as we don't expect to
- see them with large offsets. */
- complain_overflow_dont, /* complain_on_overflow */
+ complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_CRIS_32", /* name */
FALSE, /* partial_inplace */
--- bfd/reloc.c.overflow 2005-10-28 09:29:36.000000000 -0700
+++ bfd/reloc.c 2005-10-28 09:30:15.000000000 -0700
@@ -1514,6 +1514,10 @@ _bfd_relocate_contents (reloc_howto_type
a >>= rightshift;
signmask = ~ fieldmask;
+ /* We mask with addrmask here to support 32bit target with
+ 64bit bfd_vma. */
+ if (fieldmask <= addrmask)
+ signmask &= addrmask;
ss = a & signmask;
if (ss != 0 && ss != (((bfd_vma) -1 >> rightshift) & signmask))
flag = bfd_reloc_overflow;