This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix PR20789 - relaxation with negative valued diff relocs


*** TEST RESULTS FOR COMMIT 4cb771f214ed6a2102e37bce255c6be5d0642f3a ***

Author: Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
Branch: master
Commit: 4cb771f214ed6a2102e37bce255c6be5d0642f3a

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  <senthil_kumar.selvaraj@atmel.com>

       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  <senthil_kumar.selvaraj@atmel.com>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]