bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/20789] [avr] Relaxation does not correctly adjust DIFF reloc wit


From: cvs-commit at gcc dot gnu.org
Subject: [Bug ld/20789] [avr] Relaxation does not correctly adjust DIFF reloc with negative value
Date: Wed, 16 Nov 2016 10:44:35 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20789

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot 
gnu.org> ---
The master branch has been updated by Senthil Kumar Selvaraj
<address@hidden>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4cb771f214ed6a2102e37bce255c6be5d0642f3a

commit 4cb771f214ed6a2102e37bce255c6be5d0642f3a
Author: Senthil Kumar Selvaraj <address@hidden>
Date:   Wed Nov 16 16:11:46 2016 +0530

    Fix PR20789 - relaxation with negative valued diff relocs

    Fix issues with diff relocs that have a negative value
    i.e. sym2 - sym1 where sym2 is lesser than sym1.

    The assembler generates a diff reloc with symbol as start of section
    and addend as sym2 offset, and encodes assembly time difference at
    the reloc offset.

    The existing relaxation logic adjusts addends if the relaxed insn lies
    between symbol and addend. That doesn't work for diff relocs where
    sym2 is less than sym1 *and* the relaxed insn happens to be between
    sym2 and sym1.

    Fix the problems by

    1. Using signed handling of the difference value (bfd_signed_vma instead
    of bfd_vma, bfd_{get,set}_signed_xxx instead of bfd_{get,set}_xxx).

    2. Not assuming sym2 is bigger than sym1. It instead computes the actual
    addresses and sets the lower and higher addresses as start and end
    addresses respectively and then sees if insn is between start and end.

    3. Creating a new function elf32_avr_adjust_reloc_if_spans_insn to
    centralize reloc adjustment, and ensuring diff relocs get adjusted
    correctly even if their sym + addend doesn't overlap a relaxed insn.

    It also removes a redundant variable did_pad. It is never set if
    did_shrink is TRUE, and the code does a early return if did_shrink is
    FALSE.

    bfd/ChangeLog

    2016-11-15  Senthil Kumar Selvaraj  <address@hidden>

           PR ld/20789
           * bfd/elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Do signed
           manipulation of diff value, and don't assume sym2 is less than sym1.
           (elf32_avr_adjust_reloc_if_spans_insn): New function.
           (elf32_avr_relax_delete_bytes): Use
elf32_avr_adjust_diff_reloc_value,
           and remove redundant did_pad.

    ld/ChangeLog

    2016-11-15  Senthil Kumar Selvaraj  <address@hidden>

           PR ld/20789
           * ld/testsuite/ld-avr/pr20789.d: New test.
           * ld/testsuite/ld-avr/pr20789.s: New test.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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