]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
LoongArch: ld: Fix other pop relocs overflow check and add tests
authorJinyang He <hejinyang@loongson.cn>
Tue, 5 Sep 2023 02:31:28 +0000 (10:31 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Tue, 27 Feb 2024 03:54:34 +0000 (11:54 +0800)
commitb98da8583a500419c976bcfd56b80b02b1afceff
tree9f64bffba67e7b1da9b3dd97ea8ca4c55ca38f51
parent6ae2890f3b16a3d558683dd1191389e3bd5a1c58
LoongArch: ld: Fix other pop relocs overflow check and add tests

Add reloc_unsign_bits() to fix others sop_pop relocs overflow check.
Then add over/underflow tests for relocs B*, SOP_POP* and PCREL20_S2.

bfd/ChangeLog:

* bfd/elfxx-loongarch.c: Add reloc_unsign_bits().

ld/ChangeLog:

* ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp: Add tests.
* ld/testsuite/ld-loongarch-elf/abi1_max_imm.dd: New test.
* ld/testsuite/ld-loongarch-elf/abi1_max_imm.s: New test.
* ld/testsuite/ld-loongarch-elf/abi1_sops.s: New test.
* ld/testsuite/ld-loongarch-elf/abi2_max_imm.s: New test.
* ld/testsuite/ld-loongarch-elf/abi2_overflows.s: New test.
* ld/testsuite/ld-loongarch-elf/max_imm_b16.d: New test.
* ld/testsuite/ld-loongarch-elf/max_imm_b21.d: New test.
* ld/testsuite/ld-loongarch-elf/max_imm_b26.d: New test.
* ld/testsuite/ld-loongarch-elf/max_imm_pcrel20.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_b16.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_b21.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_b26.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_pcrel20.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_s_0_10_10_16_s2.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_s_0_5_10_16_s2.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_s_10_12.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_s_10_16.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_s_10_16_s2.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_s_10_5.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_s_5_20.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_u.d: New test.
* ld/testsuite/ld-loongarch-elf/overflow_u_10_12.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_b16.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_b21.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_b26.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_pcrel20.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_s_0_10_10_16_s2.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_s_0_5_10_16_s2.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_s_10_12.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_s_10_16.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_s_10_16_s2.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_s_10_5.d: New test.
* ld/testsuite/ld-loongarch-elf/underflow_s_5_20.d: New test.
35 files changed:
bfd/elfxx-loongarch.c
ld/testsuite/ld-loongarch-elf/abi1_max_imm.dd [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/abi1_max_imm.s [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/abi1_sops.s [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/abi2_max_imm.s [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/abi2_overflows.s [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
ld/testsuite/ld-loongarch-elf/max_imm_b16.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/max_imm_b21.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/max_imm_b26.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/max_imm_pcrel20.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_b16.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_b21.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_b26.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_pcrel20.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_s_0_10_10_16_s2.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_s_0_5_10_16_s2.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_s_10_12.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_s_10_16.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_s_10_16_s2.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_s_10_5.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_s_5_20.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_u.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/overflow_u_10_12.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_b16.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_b21.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_b26.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_pcrel20.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_s_0_10_10_16_s2.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_s_0_5_10_16_s2.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_s_10_12.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_s_10_16.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_s_10_16_s2.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_s_10_5.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/underflow_s_5_20.d [new file with mode: 0644]