spec: bits for loongarch64 cross-toolchain

Note: toolchains in sisyphus are too old and don't support
loongarch yet
This commit is contained in:
Алексей Шепляков 2022-11-21 16:20:56 +04:00
parent b034a392ed
commit 4cd5948add

View File

@ -41,6 +41,13 @@
%define target_libdir lib64
%endif
%if "%target_arch" == "loongarch64"
%define target_kernel loongarch
%define target_qemu_arch loongarch64
%define target_ld_linux /lib64/ld-linux-loongarch-lp64d.so.1
%define target_libdir lib64
%endif
%if "%target_arch" != "arm"
%define target %target_arch-linux-gnu
%else
@ -64,7 +71,11 @@ ExclusiveArch: x86_64
%define gcc_branch %(v=%gcc_version; v=${v%%%%.*}; echo $v)
%define binutils_version %{get_version binutils-source}
%define glibc_version %{get_version glibc-source}
%if "%target_arch" == "loongarch64"
%define kernel_version 6.0
%else
%define kernel_version 5.10
%endif
BuildPreReq: gcc-c++
@ -540,6 +551,29 @@ _start:
EOF
%endif
%if "%target_arch" == "loongarch64"
cat > bye.S <<EOF
#include <sys/syscall.h>
.data
message: .asciz "bye-bye ...\n"
.text
.global _start
_start:
li.w \$a7, __NR_write
li.w \$a0, 1 # stdout file descriptor
la \$a1, message
li.w \$a2, 12 # message length
syscall 0x0
li.w \$a7, __NR_exit
li.w \$a0, 0
syscall 0x0
.section .note.GNU-stack,"",@progbits
EOF
env PATH=%buildroot%prefix/bin:$PATH \
%buildroot%prefix/bin/%target-gcc -static -nostdlib -o bye_asm bye.S || exit 11
qemu-%target_qemu_arch-static ./bye_asm || exit 13