binutils-gdb/ld/testsuite/ld-xtensa/relax-diff1.s
Max Filippov d548f47df4 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.
2020-04-29 18:34:23 -07:00

19 lines
233 B
ArmAsm

.globl _start
.globl _ResetVector
.text
_ResetVector:
_start:
.literal_position
movi a2, 0x12345678
movi a2, 0x12345678
1:
.space 250
2:
.space 65530
3:
.align 4
.byte 1b - 2b
.byte 2b - 1b
.short 2b - 3b
.short 3b - 2b