[PATCH v7 0/5] Add support for LoongArch32
caiyinyu
caiyinyu@loongson.cn
Tue Mar 24 06:21:01 GMT 2026
LGTM
在 2026/3/23 下午3:28, mengqinggang 写道:
> Add support for LoongArch32(LA32) with ilp32d abi and
> LoongArch32 Reduced(LA32R) with ilp32s abi.
>
> The gcc and binutils master branch have added LA32 support.
>
> The kernel has added basic LA32 support[6]. But build infrastructures
> of LoongArch32 are not enabled yet, because we need to adjust
> irqchip drivers and wait for GNU toolchain be upstream first.
>
> You can build toolchains by script/build-many-glibcs.py:
> LA32 ilp32d abi:
> build-many-glibcs.py -j128 --keep all . compilers loongarch32-linux-gnu
> LA32R ilp32s abi:
> build-many-glibcs.py -j128 --keep all . compilers loongarch32-linux-gnusf
>
> LA32 tested by qemu-user and qemu-system.
> Most testcases passed on LA32.
> Tested on LA64 with no regression.
>
> These patches are based on Jiajie Chen's previous work[1].
> A Chinese LA32R instruction set manual is here[2].
> There is currently no separate LA32 instruction set manual.
> The LA64 instruction set manual[3] specifies the instructions available in LA32.
> A LA32 linux system based on qemu user is here[4].
> A LA32 linux system based on qemu system is here[5].
>
> [1] https://github.com/jiegec/glibc/tree/loongarch32
> [2] https://www.loongson.cn/uploads/images/2025032109211238668.%E9%BE%99%E6%9E%B6%E6%9E%8432%E4%BD%8D%E7%B2%BE%E7%AE%80%E7%89%88%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C_r1p04.pdf
> [3] https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-Vol1-EN/basic-integer-instructions/overview-of-basic-integer-instructions.adoc
> [4] https://github.com/sunhaiyong1978/CLFS-for-LoongArch32/blob/main/Qemu_For_LoongArch32-Simple.md
> [5] https://github.com/sunhaiyong1978/CLFS-for-LoongArch32/blob/main/Qemu_System_For_LoongArch32-Simple.md
> [6] https://lore.kernel.org/loongarch/176559874944.2388135.2320307195215147125.pr-tracker-bot@kernel.org/T/#t
>
> v6 -> v7:
> Remove "fix 'cbaud_to_speed' defined but not used on LA32" patch.
> Add new file sysdeps/loongarch/sysdep.h.
> Chang linux-gnu to linux-gnuf64 for double float abi in build-many-glibcs.py.
> Change signed variables to unsigned in sysdeps/loongarch/tst-gnu2-tls2.h.
> Delete redundant comments in sysdeps/loongarch/start.S.
> Only include gettimeofday.c once in sysdeps/unix/sysv/linux/loongarch/gettimeofday.c.
> Fix newline in sysdeps/unix/sysv/linux/loongarch/readelflib.c.
>
> v5 -> v6:
> - Change 2.43 to 2.44 in abilist files and shlib-versions.
>
> v4 -> v5:
> - Set arch_minimum_kernel to 6.19.
> - Preprocessor indentation with one space.
> - Fix defined but not used for cbaud_to_speed.
> - Define the minimum arch for loongarch64.
>
> v3 -> v4:
> - Add sysdeps/loongarch/lp64/fpu Implies subfolder for LoongArch64 implementation.
> - Set ABI baseline GLIBC_2.43 only for LoongArch32.
> - Regenerate abilist files to GLIBC_2.43.
>
> v2 -> v3:
> - Delete extra configure checks in configure.ac.
> - Change GLIBC_2.36 to GLIBC_2.43 shlib-versions.
>
> v1 -> v2:
> - Update syscall list and update abi list.
> - Delete libm-test-ulps and libm-test-ulps-name.
> - Fix tst-gnu2-tls2: change 24 to 3 * SZREG, change uint64_t to int or long.
> Do not check static float registers. Static float registers save and restore
> follow the procedure call standard and dot not require tls desc resolver
> function processing.
> - Change __NR_mmap2 to the previous __NR_mmap on lp64.
> - Change SZREG to 8 to match unsigned long long mcontext_t.__gregs.
>
> mengqinggang (5):
> LoongArch: Add support for LA32 in sysdeps/loongarch
> LoongArch: Add support for LA32 in sysdeps/loongarch/fpu
> LoongArch: Add new file for LA32 in sysdeps/loongarch/ilp32
> LoongArch: Add support for LA32 in sysdeps/unix/sysv/linux/loongarch
> LoongArch: Add new files for LA32 in
> sysdeps/unix/sysv/linux/loongarch/ilp32
>
> scripts/build-many-glibcs.py | 11 +-
> sysdeps/loongarch/configure | 29 +-
> sysdeps/loongarch/configure.ac | 21 +-
> sysdeps/loongarch/dl-machine.h | 16 +-
> sysdeps/loongarch/dl-tlsdesc-dynamic.h | 37 +-
> sysdeps/loongarch/dl-tlsdesc.S | 6 +-
> sysdeps/loongarch/dl-trampoline.h | 4 +-
> .../loongarch/fpu/math-use-builtins-llrint.h | 2 +-
> .../loongarch/fpu/math-use-builtins-logb.h | 2 +-
> .../loongarch/fpu/math-use-builtins-lrint.h | 2 +-
> .../loongarch/fpu/math-use-builtins-rint.h | 2 +-
> .../loongarch/fpu/math-use-builtins-sqrt.h | 10 +-
> sysdeps/loongarch/hp-timing.h | 9 +
> sysdeps/loongarch/ilp32/Implies-after | 1 +
> sysdeps/loongarch/lp64/fpu/Implies | 1 +
> sysdeps/loongarch/{ => lp64}/fpu/e_scalb.c | 0
> sysdeps/loongarch/{ => lp64}/fpu/e_scalbf.c | 0
> sysdeps/loongarch/{ => lp64}/fpu/s_scalbn.c | 0
> sysdeps/loongarch/{ => lp64}/fpu/s_scalbnf.c | 0
> .../loongarch/{ => lp64}/fpu/w_ilogb-impl.h | 0
> .../loongarch/{ => lp64}/fpu/w_ilogbf-impl.h | 0
> sysdeps/loongarch/preconfigure | 3 +-
> sysdeps/loongarch/preconfigure.ac | 3 +-
> sysdeps/loongarch/sfp-machine.h | 33 +
> sysdeps/loongarch/start.S | 26 +-
> sysdeps/loongarch/sys/asm.h | 38 +-
> sysdeps/loongarch/sysdep.h | 94 +
> sysdeps/loongarch/tst-gnu2-tls2.h | 58 +-
> sysdeps/unix/sysv/linux/loongarch/Makefile | 4 +-
> sysdeps/unix/sysv/linux/loongarch/clone.S | 10 +-
> sysdeps/unix/sysv/linux/loongarch/clone3.S | 8 +-
> sysdeps/unix/sysv/linux/loongarch/configure | 44 +
> .../unix/sysv/linux/loongarch/configure.ac | 12 +
> .../unix/sysv/linux/loongarch/getcontext.S | 12 +-
> .../unix/sysv/linux/loongarch/gettimeofday.c | 5 +-
> .../unix/sysv/linux/loongarch/ilp32/Implies | 2 +
> .../sysv/linux/loongarch/ilp32/arch-syscall.h | 314 +++
> .../sysv/linux/loongarch/ilp32/c++-types.data | 67 +
> .../sysv/linux/loongarch/ilp32/ld.abilist | 8 +
> .../loongarch/ilp32/libBrokenLocale.abilist | 1 +
> .../sysv/linux/loongarch/ilp32/libc.abilist | 2289 +++++++++++++++++
> .../loongarch/ilp32/libc_malloc_debug.abilist | 28 +
> .../sysv/linux/loongarch/ilp32/libm.abilist | 1166 +++++++++
> .../linux/loongarch/ilp32/libpthread.abilist | 0
> .../linux/loongarch/ilp32/libresolv.abilist | 55 +
> .../sysv/linux/loongarch/ilp32/librt.abilist | 0
> .../loongarch/ilp32/libthread_db.abilist | 40 +
> .../unix/sysv/linux/loongarch/ldd-rewrite.sed | 2 +-
> .../linux/loongarch/{ => lp64}/arch-syscall.h | 0
> .../unix/sysv/linux/loongarch/pointer_guard.h | 18 +-
> .../unix/sysv/linux/loongarch/readelflib.c | 33 +-
> .../unix/sysv/linux/loongarch/setcontext.S | 24 +-
> .../unix/sysv/linux/loongarch/shlib-versions | 10 +-
> .../unix/sysv/linux/loongarch/swapcontext.S | 28 +-
> .../sysv/linux/loongarch/syscall_cancel.S | 2 +-
> sysdeps/unix/sysv/linux/loongarch/sysdep.S | 8 +-
> sysdeps/unix/sysv/linux/loongarch/sysdep.h | 31 +-
> .../sysv/linux/loongarch/ucontext-macros.h | 6 +-
> sysdeps/unix/sysv/linux/loongarch/vfork.S | 6 +-
> 59 files changed, 4445 insertions(+), 196 deletions(-)
> create mode 100644 sysdeps/loongarch/ilp32/Implies-after
> create mode 100644 sysdeps/loongarch/lp64/fpu/Implies
> rename sysdeps/loongarch/{ => lp64}/fpu/e_scalb.c (100%)
> rename sysdeps/loongarch/{ => lp64}/fpu/e_scalbf.c (100%)
> rename sysdeps/loongarch/{ => lp64}/fpu/s_scalbn.c (100%)
> rename sysdeps/loongarch/{ => lp64}/fpu/s_scalbnf.c (100%)
> rename sysdeps/loongarch/{ => lp64}/fpu/w_ilogb-impl.h (100%)
> rename sysdeps/loongarch/{ => lp64}/fpu/w_ilogbf-impl.h (100%)
> create mode 100644 sysdeps/loongarch/sysdep.h
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/Implies
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/arch-syscall.h
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/c++-types.data
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/ld.abilist
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/libBrokenLocale.abilist
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/libc.abilist
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/libc_malloc_debug.abilist
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/libm.abilist
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/libpthread.abilist
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/libresolv.abilist
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/librt.abilist
> create mode 100644 sysdeps/unix/sysv/linux/loongarch/ilp32/libthread_db.abilist
> rename sysdeps/unix/sysv/linux/loongarch/{ => lp64}/arch-syscall.h (100%)
>
More information about the Libc-alpha
mailing list