To make it function correctly, we need to disable -O2 optimization in GNUmakefile or using __attribute__((optimize("O2"))) in
loader.c _start function, same as the riscv64 port. Also, we can not using gdb in proot, it will crash directly on kernel version 6.x, or failed to run on kernel 4.19.
Update:
After fixingassembly-loongarch.h according the way nolibc build its syscall macro, which is add $t0~$t8 to clobber list and make result from =r (read-only) to +r (read write), now proot can run correctly under O2 optimize level.
add loongarch64 support.
To make it function correctly, we need to disable -O2 optimization in GNUmakefile or using
__attribute__((optimize("O2")))
in loader.c_start
function, same as the riscv64 port. Also, we can not using gdb in proot, it will crash directly on kernel version 6.x, or failed to run on kernel 4.19.Update: After fixing
assembly-loongarch.h
according the way nolibc build its syscall macro, which is add$t0
~$t8
to clobber list and make result from=r
(read-only) to+r
(read write), now proot can run correctly underO2
optimize level.Reference: LoongArch nolibc header: https://github.com/torvalds/linux/blob/master/tools/include/nolibc/arch-loongarch.h