[PATCH v2 00/12] Add support for LoongArch32

mengqinggang mengqinggang@loongson.cn
Tue Dec 2 11:17:33 GMT 2025


Add support for LoongArch32 (LA32) and LoongArch32 Reduced (LA32R).
Add some new relocations for LA32 and LA32R.

A LA32 linux system based on qemu-user is here[1].
The gcc and glibc sources is here[2] [3].
The discussion about relocations is here[4].

[1] https://github.com/sunhaiyong1978/CLFS-for-LoongArch32/blob/main/Qemu_For_LoongArch32-Simple.md
[2] https://github.com/cloudspurs/gcc/tree/la32 
[3] https://github.com/cloudspurs/glibc/tree/la32 
[4] https://github.com/loongson/la-abi-specs/pull/16

v1 -> v2:
- Add some new relocations for LA32 and LA32R.
- Add tls type transition and got relaxation.

v1: https://sourceware.org/pipermail/binutils/2025-June/141697.html

Jiajie Chen (1):
  LoongArch: Change DWARF2_CIE_DATA_ALIGNMENT to -4 for loongarch32

Lulu Cai (1):
  LoongArch32: Fixed several regression test failures in gas and ld

mengqinggang (10):
  LoongArch: Enable loongarch_elf64_vec loongarch64_pei_vec on LA32
    target
  LoongArch: Add R_LARCH_TLS_LE_ADD_R relocation support for add.w
  LoongArch: Enable all instructions defaultly on LA32/LA64
  LoongArch: Add LA32 and LA32R relocations
  LoongArch: Add processing for LA32/LA32R relocations
  LoongArch: LA32 macros support
  LoongArch: LA32R macros expand
  LoongArch: Add linker relaxation support for R_LARCH_CALL30
  LoongArch: Add support for tls type transition on LA32
  LoongArch: Add linker relaxation for got_pcadd_hi20 and got_pcadd_lo12

 bfd/bfd-in2.h                                 |  13 +
 bfd/config.bfd                                |   2 +-
 bfd/elfnn-loongarch.c                         | 550 +++++++++++++++---
 bfd/elfxx-loongarch.c                         | 229 ++++++++
 bfd/libbfd.h                                  |  13 +
 bfd/reloc.c                                   |  27 +
 gas/config/tc-loongarch.c                     | 172 ++++--
 gas/config/tc-loongarch.h                     |   3 +-
 gas/testsuite/gas/loongarch/macro_op_32.d     |  72 ++-
 include/elf/loongarch.h                       |  35 ++
 include/opcode/loongarch.h                    |   4 +
 ld/testsuite/ld-loongarch-elf/disas-jirl-32.d |  14 +-
 ld/testsuite/ld-loongarch-elf/macro_op_32.d   |  72 ++-
 ld/testsuite/ld-loongarch-elf/pic.exp         |   4 +-
 opcodes/loongarch-opc.c                       |  42 +-
 15 files changed, 1033 insertions(+), 219 deletions(-)

-- 
2.34.1



More information about the Binutils mailing list