xtensa: fix XTENSA_NDIFF handling for PR ld/25861
authorMax Filippov <jcmvbkbc@gmail.com>
Sat, 25 Apr 2020 07:40:25 +0000 (00:40 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Thu, 30 Apr 2020 01:34:23 +0000 (18:34 -0700)
commitd548f47df4d2e3d117d504a4c9977982c78a0556
treee1dee17e4e4ef7333271c7b216105d2e146d9351
parent935f1f4ba35dc018ec6adbc1ba5f0787c84f273b
xtensa: fix XTENSA_NDIFF handling for PR ld/25861

Fields marked with XTENSA_NDIFF relocations are not negated, they only
have sign bits removed. Don't negate their values when relaxation is
performed. Don't add sign bits when the value is zero. Report overflow
when the result has negative sign but all significant bits are zero.

2020-04-29  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
* elf32-xtensa.c (relax_section): Don't negate diff_value for
XTENSA_NDIFF relocations. Don't add sign bits whe diff_value
equals 0. Report overflow when the result has negative sign but
all significant bits are zero.

ld/
* testsuite/ld-xtensa/relax-diff1.d: New test definition.
* testsuite/ld-xtensa/relax-diff1.s: New test source.
* testsuite/ld-xtensa/relax-ndiff.d: New test definition.
* testsuite/ld-xtensa/relax-ndiff.s: New test source.
* testsuite/ld-xtensa/xtensa.exp: (relax-diff1)
(relax-ndiff): New tests.
bfd/ChangeLog
bfd/elf32-xtensa.c
ld/ChangeLog
ld/testsuite/ld-xtensa/relax-diff1.d [new file with mode: 0644]
ld/testsuite/ld-xtensa/relax-diff1.s [new file with mode: 0644]
ld/testsuite/ld-xtensa/relax-ndiff.d [new file with mode: 0644]
ld/testsuite/ld-xtensa/relax-ndiff.s [new file with mode: 0644]
ld/testsuite/ld-xtensa/xtensa.exp