fast_io
                                
                                 fast_io copied to clipboard
                                
                                    fast_io copied to clipboard
                            
                            
                            
                        Todo: Fix compilation issue for clang++ --target=loongarch64-linux-gnu
The code compiles for loongarch64-linux-gnu-g++. However, it does not work for clang for unknown reasons. I guess it is probably too new for clang (the target added to clang in less than 1 month) I believe.
clang++ -o construct_fstream_from_syscall construct_fstream_from_syscall.cc -Ofast -std=c++2b -s -fuse-ld=lld -I../../include -flto=thin --target=loongarch64-linux-gnu --sysroot
=$HOME/toolchains/x86_64-w64-mingw32/loongarch64-linux-gnu
In file included from construct_fstream_from_syscall.cc:1:
In file included from ../../include/fast_io_legacy.h:25:
In file included from ../../include/fast_io.h:9:
In file included from ../../include/fast_io_hosted.h:56:
In file included from ../../include/fast_io_hosted/platforms/native.h:2:
In file included from ../../include/fast_io_hosted/platforms/native_base.h:22:
In file included from ../../include/fast_io_hosted/platforms/linux/system_call.h:12:
../../include/fast_io_hosted/platforms/linux/loongarch64.h:15:42: error: unknown register name '$a7' in asm
        register std::uint_least64_t a7 __asm__("$a7") = syscall_number;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:16:42: error: unknown register name '$a0' in asm
        register std::uint_least64_t a0 __asm__("$a0");
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:30:42: error: unknown register name '$a7' in asm
        register std::uint_least64_t a7 __asm__("$a7") = syscall_number;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:31:42: error: unknown register name '$a0' in asm
        register std::uint_least64_t a0 __asm__("$a0") = (std::uint_least64_t)p1;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:44:42: error: unknown register name '$a7' in asm
        register std::uint_least64_t a7 __asm__("$a7") = syscall_number;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:45:42: error: unknown register name '$a0' in asm
        register std::uint_least64_t a0 __asm__("$a0") = (std::uint_least64_t)p1;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:58:42: error: unknown register name '$a7' in asm
        register std::uint_least64_t a7 __asm__("$a7") = syscall_number;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:59:42: error: unknown register name '$a0' in asm
        register std::uint_least64_t a0 __asm__("$a0") = (std::uint_least64_t)p1;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:60:42: error: unknown register name '$a1' in asm
        register std::uint_least64_t a1 __asm__("$a1") = (std::uint_least64_t)p2;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:74:42: error: unknown register name '$a7' in asm
        register std::uint_least64_t a7 __asm__("$a7") = syscall_number;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:75:42: error: unknown register name '$a0' in asm
        register std::uint_least64_t a0 __asm__("$a0") = (std::uint_least64_t)p1;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:76:42: error: unknown register name '$a1' in asm
        register std::uint_least64_t a1 __asm__("$a1") = (std::uint_least64_t)p2;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:77:42: error: unknown register name '$a2' in asm
        register std::uint_least64_t a2 __asm__("$a2") = (std::uint_least64_t)p3;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:91:42: error: unknown register name '$a7' in asm
        register std::uint_least64_t a7 __asm__("$a7") = syscall_number;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:92:42: error: unknown register name '$a0' in asm
        register std::uint_least64_t a0 __asm__("$a0") = (std::uint_least64_t)p1;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:93:42: error: unknown register name '$a1' in asm
        register std::uint_least64_t a1 __asm__("$a1") = (std::uint_least64_t)p2;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:94:42: error: unknown register name '$a2' in asm
        register std::uint_least64_t a2 __asm__("$a2") = (std::uint_least64_t)p3;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:95:42: error: unknown register name '$a3' in asm
        register std::uint_least64_t a3 __asm__("$a3") = (std::uint_least64_t)p4;
                                                ^
../../include/fast_io_hosted/platforms/linux/loongarch64.h:109:42: error: unknown register name '$a7' in asm
        register std::uint_least64_t a7 __asm__("$a7") = syscall_number;
                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
It looks like it is the LLVM's issue. There is nothing i can do about it right now. Probably the situation will get fixed soon.
error: unable to create target: 'No available targets are compatible with triple "loongarch64-unknown-linux-gnu"'
1 error generated.
Fixed from clang upstream