[PATCH 0/3] LoongArch: Optimize ADD/SUB and PC-relative relocations handling

mengqinggang mengqinggang@loongson.cn
Thu Aug 13 17:07:33 GMT 2026


Patch 1: Support emitting relocations for .long 0x2eef - symbol.
Patch 2: Optimize TC_FORCE_RELOCATION_SUB_LOCAL to reduce fixups.
Patch 3: Fix md_pcrel_from to return the correct PC-relative base address.

mengqinggang (3):
  LoongArch: Emit relocations for .long 0x2eef - symbol
  LoongArch: Optimize TC_FORCE_RELOCATION_SUB_LOCAL
  LoongArch: Fix md_pcrel_from

 gas/config/tc-loongarch.c                     | 184 ++++++++++--------
 gas/config/tc-loongarch.h                     |   3 -
 gas/testsuite/gas/loongarch/bfd_reloc_8.s     |  16 --
 gas/testsuite/gas/loongarch/loongarch.exp     |   2 +-
 gas/testsuite/gas/loongarch/reloc-abs-data.d  |  18 ++
 gas/testsuite/gas/loongarch/reloc-abs-data.s  |  12 ++
 .../gas/loongarch/reloc-abs-norelax.d         |  18 ++
 gas/testsuite/gas/loongarch/reloc-abs-pcrel.d |  18 ++
 gas/testsuite/gas/loongarch/reloc-abs-relax.d |  23 +++
 gas/testsuite/gas/loongarch/reloc-abs-relax.s |  12 ++
 gas/testsuite/gas/loongarch/reloc-abs.d       |  23 +++
 gas/testsuite/gas/loongarch/reloc-abs.s       |  12 ++
 gas/testsuite/gas/loongarch/reloc-add-sub.d   |  22 +++
 gas/testsuite/gas/loongarch/reloc-add-sub.s   |  16 ++
 .../gas/loongarch/thin_add_sub_relax.d        |   6 +-
 15 files changed, 284 insertions(+), 101 deletions(-)
 delete mode 100644 gas/testsuite/gas/loongarch/bfd_reloc_8.s
 create mode 100644 gas/testsuite/gas/loongarch/reloc-abs-data.d
 create mode 100644 gas/testsuite/gas/loongarch/reloc-abs-data.s
 create mode 100644 gas/testsuite/gas/loongarch/reloc-abs-norelax.d
 create mode 100644 gas/testsuite/gas/loongarch/reloc-abs-pcrel.d
 create mode 100644 gas/testsuite/gas/loongarch/reloc-abs-relax.d
 create mode 100644 gas/testsuite/gas/loongarch/reloc-abs-relax.s
 create mode 100644 gas/testsuite/gas/loongarch/reloc-abs.d
 create mode 100644 gas/testsuite/gas/loongarch/reloc-abs.s
 create mode 100644 gas/testsuite/gas/loongarch/reloc-add-sub.d
 create mode 100644 gas/testsuite/gas/loongarch/reloc-add-sub.s

-- 
2.34.1



More information about the Binutils mailing list