This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[Patch] Tiny i860 relocation glitches (committed)
- From: Jason Eckhardt <jle at owlnet dot rice dot edu>
- To: <binutils at sources dot redhat dot com>
- Date: Sun, 11 May 2003 22:12:24 -0500 (CDT)
- Subject: [Patch] Tiny i860 relocation glitches (committed)
Re-linking the Linux/i860 kernel at a new VMA caused it to start
failing in strange ways. This patch fixes it.
2003-05-11 Jason Eckhardt <jle@rice.edu>
* bfd/elf32-i860.c (elf32_i860_relocate_highadj): Properly
adjust upper bits.
(elf32_i860_relocate_splitn): Obtain upper 5 bits from the
proper place.
(elf32_i860_relocate_pc16): Obtain upper 5 bits from the
proper place.
Index: elf32-i860.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i860.c,v
retrieving revision 1.19
diff -c -3 -p -r1.19 elf32-i860.c
*** elf32-i860.c 30 Nov 2002 08:39:37 -0000 1.19
--- elf32-i860.c 12 May 2003 03:03:27 -0000
*************** elf32_i860_relocate_splitn (input_bfd, r
*** 718,724 ****
value += rello->r_addend;
/* Separate the fields and insert. */
! value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
--- 718,724 ----
value += rello->r_addend;
/* Separate the fields and insert. */
! value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
*************** elf32_i860_relocate_pc16 (input_bfd, inp
*** 750,756 ****
value += rello->r_addend;
/* Separate the fields and insert. */
! value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
--- 750,756 ----
value += rello->r_addend;
/* Separate the fields and insert. */
! value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
*************** elf32_i860_relocate_highadj (input_bfd,
*** 802,809 ****
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- value += ((rel->r_addend & 0x8000) << 1);
value += rel->r_addend;
value = ((value >> 16) & 0xffff);
insn = (insn & 0xffff0000) | value;
--- 802,809 ----
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
value += rel->r_addend;
+ value += (value & 0x8000) << 1;
value = ((value >> 16) & 0xffff);
insn = (insn & 0xffff0000) | value;