bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARM/Thumb long calls stubs


From: Nick Clifton
Subject: Re: ARM/Thumb long calls stubs
Date: 06 May 2002 14:45:25 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

Hi Oleg,

> I send you the example of what I consider to be a bug in ld.
> I get no warnings or error messages from ld.

Thanks for sending this test case, although it really is better if you
send the test to the binutils mailing list and not to me directly.

Anyway I have been able to reproduce the first problem you described
using the test case and I am attaching a patch below to fix it.

The problem was that although the code in the linker was checking to
see if the thumb BL instruction's relocation overflowed, it was using
the wrong values for the maximum and minimum offsets.  The code was
checking 'signed_reloc' which had been adjusted to be a half-word
offset, against 'reloc_signed_max' and 'reloc_signed_min' which were
still set as byte offsets.

I will be checking this patch intot he mainline and branch sources
shortly.

Cheers
        Nick

2002-05-06  Nick Clifton  <address@hidden>

        * elf32-arm.h (elf32_arm_final_link_relocate): Convert
        'reloc_signed_max' and 'reloc_signed_min' into half-word offsets.

Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.79
diff -c -3 -p -w -r1.79 elf32-arm.h
*** bfd/elf32-arm.h     4 Apr 2002 19:53:36 -0000       1.79
--- bfd/elf32-arm.h     6 May 2002 13:39:08 -0000
*************** elf32_arm_final_link_relocate (howto, in
*** 1390,1396 ****
        boolean        overflow = false;
        bfd_vma        upper_insn = bfd_get_16 (input_bfd, hit_data);
        bfd_vma        lower_insn = bfd_get_16 (input_bfd, hit_data + 2);
!       bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
        bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
        bfd_vma        check;
        bfd_signed_vma signed_check;
--- 1390,1396 ----
        boolean        overflow = false;
        bfd_vma        upper_insn = bfd_get_16 (input_bfd, hit_data);
        bfd_vma        lower_insn = bfd_get_16 (input_bfd, hit_data + 2);
!       bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> 
howto->rightshift;
        bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
        bfd_vma        check;
        bfd_signed_vma signed_check;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]