binutils-gdb/ld/testsuite/ld-riscv-elf/relax-twice-2.s
Michael Matz 235f5ef4a6 elf/riscv: Fix relaxation with aliases [PR28021]
the fix for PR22756 only changed behaviour for hidden aliases,
but the same situation exists for non-hidden aliases: sym_hashes[]
can contain multiple entries pointing to the same symbol structure
leading to relaxation adjustment to be applied twice.

Fix this by testing for duplicates for everything that looks like it
has a version.

PR ld/28021

bfd/
	* elfnn-riscv.c (riscv_relax_delete_bytes): Check for any
	versioning.

ld/
	* testsuite/ld-riscv-elf/relax-twice.ver: New.
	* testsuite/ld-riscv-elf/relax-twice-1.s: New.
	* testsuite/ld-riscv-elf/relax-twice-2.s: New.
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp
	(run_relax_twice_test): New, and call it.
2021-07-06 15:49:03 +02:00

45 lines
744 B
ArmAsm

.file "<artificial>"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "%u"
.text
.align 1
.globl relaxme
.type relaxme, @function
relaxme:
addi sp,sp,-32
addi a2,sp,12
lla a1,.LC0
li a0,0
sd ra,24(sp)
call sscanf@plt
ld ra,24(sp)
addi sp,sp,32
jr ra
.size relaxme, .-relaxme
.align 1
.globl foobar_new
.type foobar_new, @function
foobar_new:
li a0,1
ret
.size foobar_new, .-foobar_new
.symver foobar_new, foobar@@New
.align 1
.globl foobar_old
.type foobar_old, @function
foobar_old:
addi sp,sp,-16
sd ra,8(sp)
call foobar@plt
ld ra,8(sp)
snez a0,a0
addi sp,sp,16
jr ra
.size foobar_old, .-foobar_old
.symver foobar_old, foobar@Old
.section .note.GNU-stack,"",@progbits