]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
LoongArch/GAS: Add support for branch relaxation
authormengqinggang <mengqinggang@loongson.cn>
Sun, 24 Sep 2023 06:53:28 +0000 (14:53 +0800)
committercailulu <cailulu@loongson.cn>
Mon, 24 Feb 2025 07:56:54 +0000 (15:56 +0800)
commit9f5d411c20126489baf9d6b858c850529957c3b2
treef86b9f46022451e0aae81ee5dbfcdde6680a2009
parent94c65b893a7aea968b06a3e97eef466abc49fbe5
LoongArch/GAS: Add support for branch relaxation

For the instructions of R_LARCH_B16/B21, if the immediate overflow,
add a B instruction and R_LARCH_B26 relocation.

For example:

.L1
  ...
  blt $t0, $t1, .L1
    R_LARCH_B16

change to:

.L1
  ...
  bge $t0, $t1, .L2
  b .L1
    R_LARCH_B26
.L2

(cherry picked from commit 1fb3cdd87ec61715a5684925fb6d6a6cf53bb97c)
gas/config/tc-loongarch.c
gas/testsuite/gas/loongarch/la_branch_relax_1.d [new file with mode: 0644]
gas/testsuite/gas/loongarch/la_branch_relax_1.s [new file with mode: 0644]
gas/testsuite/gas/loongarch/la_branch_relax_2.d [new file with mode: 0644]
gas/testsuite/gas/loongarch/la_branch_relax_2.s [new file with mode: 0644]
include/opcode/loongarch.h