bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/20545] [avr] Incorrect offsets computed for PC relative jumps wi


From: cvs-commit at gcc dot gnu.org
Subject: [Bug ld/20545] [avr] Incorrect offsets computed for PC relative jumps with linker relaxation and alignment directives
Date: Tue, 06 Sep 2016 07:16:28 +0000

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

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

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

commit 3cb2b3db2e1163ee324894364538e7247c37350b
Author: Senthil Kumar Selvaraj <address@hidden>
Date:   Tue Sep 6 12:28:37 2016 +0530

    Fix PR ld/20545 - relaxation bugs in avr backend

    Prior to the patch, addends for relocs were being adjusted even if
    they went beyond an alignment boundary. This is wrong - to
    preserve alignment constraints, the relaxation logic adds as many padding
    bytes at the alignment boundary as was deleted, so addends beyond the
    boundary should not be adjusted. avr-prop-7.s reproduces this
    scenario.

    Also, prior to this patch, the relaxation logic assumed that the addr
    parameter pointed to the middle of the instruction to be deleted, and
    that addr - count would therefore be the shrinked instruction's
    address. This is true when actually shrinking instructions.

    The alignment constraints handling logic also invokes the same logic
    though, with addr as the starting offset of padding bytes and
    with count as the number of bytes to be deleted. Calculating the
    shrinked insn's address as addr - count is obviously wrong in this
    case - that offset would point to count bytes before the last
    non-padded byte. avr-prop-8.s reproduces this scenario.

    To fix scenario 1, the patch adds an additional check to ensure reloc
addends
    aren't adjusted if they cross a shrink boundary. The shrink boundary
    is either the section size or an alignment boundary. Addends pointing
    at an alignment boundary don't need to be adjusted, as padding would
    occur and keep the boundary the same. Addends pointing at section size
    need to be adjusted though, as no padding occurs and the section size
    itself would get decremented. The patch records whether padding
    occured (did_pad) and uses that to detect and handle this condition.

    To fix scenario 2, the patch adds an additional parameter
    (delete_shrinks_insn) to elf32_avr_relax_delete_bytes to distinguish
    instruction bytes deletion from padding bytes deletion. It then uses that
to
    correctly set shrinked_insn_address.

    bfd/ChangeLog:

    2016-09-06  Senthil Kumar Selvaraj  <address@hidden>

        Backport from mainline
        2016-09-02  Senthil Kumar Selvaraj  <address@hidden>

        PR ld/20545
        * elf32-avr.c (elf32_avr_relax_delete_bytes): Add parameter
        delete_shrinks_insn. Modify computation of shrinked_insn_address.
        Compute shrink_boundary and adjust addend only if
        addend_within_shrink_boundary.
        (elf32_avr_relax_section): Modify calls to
        elf32_avr_relax_delete_bytes to pass extra parameter.

    ld/ChangeLog:

    2016-09-06  Senthil Kumar Selvaraj  <address@hidden>

        Backport from mainline
        2016-09-02  Senthil Kumar Selvaraj  <address@hidden>

        PR ld/20545
        * testsuite/ld-avr/avr-prop-7.d: New test.
        * testsuite/ld-avr/avr-prop-7.s: New test.
        * testsuite/ld-avr/avr-prop-8.d: New test.
        * testsuite/ld-avr/avr-prop-8.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]