[PATCH v2 0/5] Add support for LoongArch32

mengqinggang mengqinggang@loongson.cn
Wed Dec 31 02:27:00 GMT 2025


Thanks for your review! I will resolve these question in next patches.


在 2025/12/31 03:44, Adhemerval Zanella Netto 写道:
>
> On 30/12/25 06:51, mengqinggang wrote:
>> Hi Adhemerval,
>>
>> If you have time to review and the v5 patches need to be send.
>> Please let me know. Thank you very much!
> I think you meant v4, since this is latest one in patchwork [1].
> And I just realized that loongarch32 official supports was introduced in
> Linux 6.19, which is schedule be released only in February 1 [2].
>
> I noticed it when I bootstrapped a loongarch32 and the misc/tst-glibcsyscalls
> failed with a lot of errors:
>
>    info: glibc syscall 'semtimedop_time64' not known to kernel
>    info: glibc syscall 'io_pgetevents_time64' not known to kernel
>    [...]
>    error: kernel syscall 'lseek' (62) not known to glibc
>    error: kernel syscall 'timer_gettime' (108) not known to glibc
>    [...]
>    info: glibc tables are based on kernel version 6.17
>    info: installed kernel headers are version 6.17
>
> I am not sure if our policy allows ABIs that are in only release Linux
> versions, but at least this is what build-many-glibc.py expects (and
> what other glibc developers would use to check any breakage on loongarch32).
> So I think it would be better to postpone it to glibc 2.44 (and it will
> also helps the toolchain version issues I found below).
>
> Besides it, I also found out that although the release branch of binutils
> 2.45 does support loongarch32, it is not suffice to fully bootstrap a
> toolchain with build-many-glibcs. The script fails at stage1 with multiple
> assembler issues:
>
>    /tmp/ccxelT0j.s: Assembler messages:
>    /tmp/ccxelT0j.s:33: Error: register save offset not a multiple of 8
>    /tmp/ccxelT0j.s:35: Error: register save offset not a multiple of 8
>    /tmp/ccxelT0j.s:37: Error: register save offset not a multiple of 8
>    /tmp/ccxelT0j.s:38: Error: register save offset not a multiple of 8
>    /tmp/ccxelT0j.s:40: Error: register save offset not a multiple of 8
>    /tmp/ccxelT0j.s:42: Error: register save offset not a multiple of 8
>    /tmp/ccxelT0j.s:105: Fatal error: unsupported modifier call30
>
> I think you will need to at least fix it on the release branch (if not
> also on possible a release package as well).  I am not sure if this impacts
> the glibc build itself, but if it were the case I would expect to have
> a configure check to fail early.
>
> It is similar to gcc, where the current bmg will use gcc-15 while loongarch32
> targets gcc-16.
>
> I also found a 'make check' build failure that I am not sure why have not
> see it as well (I used gcc 16 master branch):
>
>    loongarch32-glibc-linux-gnu-gcc ../sysdeps/unix/sysv/linux/tst-termios-linux.c [...]
>    ../sysdeps/unix/sysv/linux/tst-termios-linux.c:167:16: error: ‘cbaud_to_speed’ defined but not used [-Werror=unused-function]
>    167 | static speed_t cbaud_to_speed (speed_t cbaud)
>        |                ^~~~~~~~~~~~~~
>
> [1] https://patchwork.sourceware.org/project/glibc/list/?submitter=36431
> [2] https://lwn.net/Articles/1049424/
>
>> 在 2025/12/30 01:31, Andreas K. Huettel 写道:
>>> So, after skimming also the threads on gcc and binutils, I'm not really fundamentally
>>> opposed to still adding LoongArch32 in 2.43. But- we still need patch review (R-B).
>>>
>>> My suggestion would be:
>>> * If you manage to get a complete review before we start the machine testing (planned
>>>     4/January), let's still add it.
>>> * Otherwise, let's delay it until after the release and add it to master afterwards.
>>>
>>>
>>> Am Montag, 29. Dezember 2025, 15:25:34 Mitteleuropäische Normalzeit schrieb Adhemerval Zanella Netto:
>>>> I think it was sent too late, considering the last version (v4). The patchset
>>>> is not large, most of the additions is the abilist files; so I think it should
>>>> be feasible to review (assuming some would take this work for 2.43).
>>>>
>>>> Andreas, do you prefer to postpone to 2.44 or should it be ok for 2.43?
>>>>
>>>> On 25/12/25 05:06, mengqinggang wrote:
>>>>> I send a v4 patch series for LoongArch32.
>>>>> The binutils, gcc and kernel upstream master branch have add LoongArch32 support.
>>>>> Do we need to wait for them release a new version?
>>>>>
>>>>>
>>>>> 在 2025/12/22 20:22, Andreas K. Huettel 写道:
>>>>>> Am Donnerstag, 18. Dezember 2025, 13:30:06 Mitteleuropäische Normalzeit schrieb mengqinggang:
>>>>>>> Add support for LoongArch32(LA32) with ilp32d abi and
>>>>>>> LoongArch32 Reduced(LA32R) with ilp32s abi.
>>>>>> Do you intend to have this included in 2.43 ?
>>>>>>
>>>>>> I would personally rather recommend we add it at earliest immediately after
>>>>>> the realease.
>>>>>>
>>>>>>> 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 except for several
>>>>>>> about gdb and math-fenv on soft float abi.
>>>>>>> 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
>>>>>>>



More information about the Libc-alpha mailing list