binutils-gdb/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d
Lewis Revill c628f812eb RISC-V: Added ld testcase for pcgp relaxation.
Consider the the pcgp-relax-02 testcase,

        .text
        .globl _start
_start:
.L1:    auipc   a0, %pcrel_hi(data_a)
.L2:    auipc   a1, %pcrel_hi(data_b)
        addi    a0, a0, %pcrel_lo(.L1)
        addi    a1, a1, %pcrel_lo(.L2)

        .data
        .word 0x0
        .globl data_a
data_a:
        .word 0x1

        .section .rodata
        .globl data_b
data_b:
        .word 0x2

If the first auipc is deleted, but we are still building the pcgp
table (connect the high and low pcrel relocations), then there is
an aliasing issue that we need some way to disambiguate which of
the two symbols we are targeting.  Therefore, Palmer thought of a
way to use R_RISCV_DELETE to split this into two phases, so we
could resolve the addresses before creating the ambiguities.

This patch just add the ld testcase for the above case, in case we
have changed something but break this.

ld/
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Renamed pcgp-relax
	to pcgp-relax-01, and added pcgp-relax-02.
	* testsuite/ld-riscv-elf/pcgp-relax-01.d: Renmaed from pcgp-relax.
	* testsuite/ld-riscv-elf/pcgp-relax-01.s: Likewise.
	* testsuite/ld-riscv-elf/pcgp-relax-02.d: New testcase.
	* testsuite/ld-riscv-elf/pcgp-relax-02.s: Likewise.
2021-10-22 16:44:43 +08:00

16 lines
270 B
Makefile

#source: pcgp-relax-02.s
#as:
#ld: --relax
#objdump: -d
.*:[ ]+file format .*
Disassembly of section .text:
[0-9a-f]+ <_start>:
.*:[ ]+[0-9a-f]+[ ]+auipc[ ]+a1.*
.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,gp.*<data_a>
.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a1,a1.*<data_b>
#pass