From nobody Sat Feb 7 18:15:34 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2383C7EE2E for ; Wed, 7 Jun 2023 09:27:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239955AbjFGJ07 (ORCPT ); Wed, 7 Jun 2023 05:26:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231890AbjFGJ04 (ORCPT ); Wed, 7 Jun 2023 05:26:56 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2205192; Wed, 7 Jun 2023 02:26:53 -0700 (PDT) X-QQ-mid: bizesmtp85t1686130004t6q4nk80 Received: from linux-lab-host.localdomain ( [61.141.77.49]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 07 Jun 2023 17:26:42 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: ILHsT53NKPj2LqWj5vPyBfMEU/EQPK5yuVIJM9GKtuNMJ/hPIBysmg81s1Gz8 MkS3Lc5amQL/k7yLa8D+oVg2tmKv06roQQbcHxNopt+q4lhrjDKo9IKh0bT6+zrelNB00bw QEmIVod6Rz2V6rwRmV9eu74xuYISdx3nhJfhAdmnoCXhxuFLzJvvvh4PkO8yDSXqzHpKfaZ QS+7MAonVNqy4ephWB7/ZPT3CcsHK1l/5ZHNgmfCejGPizJglGYb3h3XKuSZGD75+TpXlbC d9+GuHkdjxLCGaB7V3NeIDZJPRehsSntXVHqnFGmOhygN6tnnOQu9TKRTHdGfa3HIxVPCLG 0GmlGQp0tZS5pUXTdEMyj3xn5SKRblWKqMcFzZlQ6xLJlIZDEsqvdwAe//jdKDwkvZpTgXz X-QQ-GoodBg: 0 X-BIZMAIL-ID: 14623160687677460193 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v4 1/3] tools/nolibc: fix up #error compile failures with -ENOSYS Date: Wed, 7 Jun 2023 17:24:12 +0800 Message-Id: <149f2f9b6db8f927298446b0e92fda2d0a3430ae.1686128703.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Compiling nolibc for rv32 got such errors: In file included from nolibc/sysroot/riscv/include/nolibc.h:99, from nolibc/sysroot/riscv/include/errno.h:26, from nolibc/sysroot/riscv/include/stdio.h:14, from tools/testing/selftests/nolibc/nolibc-test.c:12: nolibc/sysroot/riscv/include/sys.h:946:2: error: #error Neither __NR_pp= oll nor __NR_poll defined, cannot implement sys_poll() 946 | #error Neither __NR_ppoll nor __NR_poll defined, cannot impleme= nt sys_poll() | ^~~~~ nolibc/sysroot/riscv/include/sys.h:1062:2: error: #error None of __NR_s= elect, __NR_pselect6, nor __NR__newselect defined, cannot implement sys_sel= ect() 1062 | #error None of __NR_select, __NR_pselect6, nor __NR__newselect = defined, cannot implement sys_select() If a syscall is not supported by a target platform, 'return -ENOSYS' is better than '#error', which lets the other syscalls work as-is and allows developers to fix up the test failures reported by nolibc-test one by one later. This converts all of the '#error' to 'return -ENOSYS', so, all of the '#error' failures are fixed. Suggested-by: Arnd Bergmann Link: https://lore.kernel.org/linux-riscv/5e7d2adf-e96f-41ca-a4c6-5c87a25d4= c9c@app.fastmail.com/ Reviewed-by: Arnd Bergmann Signed-off-by: Zhangjin Wu --- tools/include/nolibc/sys.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 856249a11890..78c86f124335 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -124,7 +124,7 @@ int sys_chmod(const char *path, mode_t mode) #elif defined(__NR_chmod) return my_syscall2(__NR_chmod, path, mode); #else -#error Neither __NR_fchmodat nor __NR_chmod defined, cannot implement sys_= chmod() + return -ENOSYS; #endif } =20 @@ -153,7 +153,7 @@ int sys_chown(const char *path, uid_t owner, gid_t grou= p) #elif defined(__NR_chown) return my_syscall3(__NR_chown, path, owner, group); #else -#error Neither __NR_fchownat nor __NR_chown defined, cannot implement sys_= chown() + return -ENOSYS; #endif } =20 @@ -251,7 +251,7 @@ int sys_dup2(int old, int new) #elif defined(__NR_dup2) return my_syscall2(__NR_dup2, old, new); #else -#error Neither __NR_dup3 nor __NR_dup2 defined, cannot implement sys_dup2() + return -ENOSYS; #endif } =20 @@ -351,7 +351,7 @@ pid_t sys_fork(void) #elif defined(__NR_fork) return my_syscall0(__NR_fork); #else -#error Neither __NR_clone nor __NR_fork defined, cannot implement sys_fork= () + return -ENOSYS; #endif } #endif @@ -648,7 +648,7 @@ int sys_link(const char *old, const char *new) #elif defined(__NR_link) return my_syscall2(__NR_link, old, new); #else -#error Neither __NR_linkat nor __NR_link defined, cannot implement sys_lin= k() + return -ENOSYS; #endif } =20 @@ -700,7 +700,7 @@ int sys_mkdir(const char *path, mode_t mode) #elif defined(__NR_mkdir) return my_syscall2(__NR_mkdir, path, mode); #else -#error Neither __NR_mkdirat nor __NR_mkdir defined, cannot implement sys_m= kdir() + return -ENOSYS; #endif } =20 @@ -729,7 +729,7 @@ long sys_mknod(const char *path, mode_t mode, dev_t dev) #elif defined(__NR_mknod) return my_syscall3(__NR_mknod, path, mode, dev); #else -#error Neither __NR_mknodat nor __NR_mknod defined, cannot implement sys_m= knod() + return -ENOSYS; #endif } =20 @@ -848,7 +848,7 @@ int sys_open(const char *path, int flags, mode_t mode) #elif defined(__NR_open) return my_syscall3(__NR_open, path, flags, mode); #else -#error Neither __NR_openat nor __NR_open defined, cannot implement sys_ope= n() + return -ENOSYS; #endif } =20 @@ -943,7 +943,7 @@ int sys_poll(struct pollfd *fds, int nfds, int timeout) #elif defined(__NR_poll) return my_syscall3(__NR_poll, fds, nfds, timeout); #else -#error Neither __NR_ppoll nor __NR_poll defined, cannot implement sys_poll= () + return -ENOSYS; #endif } =20 @@ -1059,7 +1059,7 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, = fd_set *efds, struct timeva #endif return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout); #else -#error None of __NR_select, __NR_pselect6, nor __NR__newselect defined, ca= nnot implement sys_select() + return -ENOSYS; #endif } =20 @@ -1196,7 +1196,7 @@ int sys_stat(const char *path, struct stat *buf) #elif defined(__NR_stat) ret =3D my_syscall2(__NR_stat, path, &stat); #else -#error Neither __NR_newfstatat nor __NR_stat defined, cannot implement sys= _stat() + return -ENOSYS; #endif buf->st_dev =3D stat.st_dev; buf->st_ino =3D stat.st_ino; @@ -1243,7 +1243,7 @@ int sys_symlink(const char *old, const char *new) #elif defined(__NR_symlink) return my_syscall2(__NR_symlink, old, new); #else -#error Neither __NR_symlinkat nor __NR_symlink defined, cannot implement s= ys_symlink() + return -ENOSYS; #endif } =20 @@ -1312,7 +1312,7 @@ int sys_unlink(const char *path) #elif defined(__NR_unlink) return my_syscall1(__NR_unlink, path); #else -#error Neither __NR_unlinkat nor __NR_unlink defined, cannot implement sys= _unlink() + return -ENOSYS; #endif } =20 --=20 2.25.1 From nobody Sat Feb 7 18:15:34 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79DAFC7EE29 for ; Wed, 7 Jun 2023 09:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239917AbjFGJg2 (ORCPT ); Wed, 7 Jun 2023 05:36:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239837AbjFGJgZ (ORCPT ); Wed, 7 Jun 2023 05:36:25 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D18A31BC2; Wed, 7 Jun 2023 02:36:03 -0700 (PDT) X-QQ-mid: bizesmtp71t1686130553tmsdhqdy Received: from linux-lab-host.localdomain ( [61.141.77.49]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 07 Jun 2023 17:35:52 +0800 (CST) X-QQ-SSF: 00200000000000D0V000000A0000000 X-QQ-FEAT: lkL5M32tl2CKtzfdmJppNXVfPo4dxxS2i5yjRnmFQwVRtg9qihhO/bdGb8f45 yWn2uxZLxaR03l3EEyG3ZSe+rmOHf0zQcc978/tiuiHl9/xeA/a5gsfw1Iz5iwm9HgXYtxx PP8ebuEvcyWxkYw5KtdUj/NMNt0ADHXsRQs4S7w5o7GFUXvGt70EaVa1Z9M2HAzmkU0j/3+ Ly/ztVpho8T0NWn1hGi9u1c3QjZoSjFOtbvsYaVB9tnmAOJ4B3oiKbDMiv+FjFA+JDdXPCE Izip3hN+MT1jbZAgpNtiTLAHenU2xXWtiLfC3EzFz8W4ty+E3z3Xdes0vghwexbdeA149FC 1h5T5I9ph8YUWFsHRh2goaMbO2tFv9l+YES8qlLlsYf4mDSk5c1NABZFvisRPFGLWZakBFf qSvd39YkcwE= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 14568529187218780332 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v4 2/3] tools/nolibc: fix up undeclared syscall macros with #ifdef and -ENOSYS Date: Wed, 7 Jun 2023 17:27:52 +0800 Message-Id: <1b2ace57de2f47ae0da4457845594baf59f7e06d.1686128703.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Compiling nolibc for rv32 got such errors: nolibc/sysroot/riscv/include/sys.h: In function =E2=80=98sys_gettimeofd= ay=E2=80=99: nolibc/sysroot/riscv/include/sys.h:557:21: error: =E2=80=98__NR_gettime= ofday=E2=80=99 undeclared (first use in this function); did you mean =E2=80= =98sys_gettimeofday=E2=80=99? 557 | return my_syscall2(__NR_gettimeofday, tv, tz); | ^~~~~~~~~~~~~~~~~ nolibc/sysroot/riscv/include/sys.h: In function =E2=80=98sys_lseek=E2= =80=99: nolibc/sysroot/riscv/include/sys.h:675:21: error: =E2=80=98__NR_lseek= =E2=80=99 undeclared (first use in this function) 675 | return my_syscall3(__NR_lseek, fd, offset, whence); | ^~~~~~~~~~ nolibc/sysroot/riscv/include/sys.h: In function =E2=80=98sys_wait4=E2= =80=99: nolibc/sysroot/riscv/include/sys.h:1341:21: error: =E2=80=98__NR_wait4= =E2=80=99 undeclared (first use in this function) 1341 | return my_syscall4(__NR_wait4, pid, status, options, rusage); If a syscall macro is not supported by a target platform, wrap it with '#ifdef' and 'return -ENOSYS' for the '#else' branch, which lets the other syscalls work as-is and allows developers to fix up the test failures reported by nolibc-test one by one later. This wraps all of the failed syscall macros with '#ifdef' and 'return -ENOSYS' for the '#else' branch, so, all of the undeclared failures are fixed. Suggested-by: Arnd Bergmann Link: https://lore.kernel.org/linux-riscv/5e7d2adf-e96f-41ca-a4c6-5c87a25d4= c9c@app.fastmail.com/ Reviewed-by: Arnd Bergmann Signed-off-by: Zhangjin Wu --- tools/include/nolibc/sys.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 78c86f124335..5464f93e863e 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -554,7 +554,11 @@ long getpagesize(void) static __attribute__((unused)) int sys_gettimeofday(struct timeval *tv, struct timezone *tz) { +#ifdef __NR_gettimeofday return my_syscall2(__NR_gettimeofday, tv, tz); +#else + return -ENOSYS; +#endif } =20 static __attribute__((unused)) @@ -672,7 +676,11 @@ int link(const char *old, const char *new) static __attribute__((unused)) off_t sys_lseek(int fd, off_t offset, int whence) { +#ifdef __NR_lseek return my_syscall3(__NR_lseek, fd, offset, whence); +#else + return -ENOSYS; +#endif } =20 static __attribute__((unused)) @@ -1338,7 +1346,11 @@ int unlink(const char *path) static __attribute__((unused)) pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage) { +#ifdef __NR_wait4 return my_syscall4(__NR_wait4, pid, status, options, rusage); +#else + return -ENOSYS; +#endif } =20 static __attribute__((unused)) --=20 2.25.1 From nobody Sat Feb 7 18:15:34 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88420C77B7A for ; Wed, 7 Jun 2023 09:43:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239712AbjFGJnc (ORCPT ); Wed, 7 Jun 2023 05:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239485AbjFGJn1 (ORCPT ); Wed, 7 Jun 2023 05:43:27 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C132EB; Wed, 7 Jun 2023 02:43:24 -0700 (PDT) X-QQ-mid: bizesmtp80t1686130994t5ggma8m Received: from linux-lab-host.localdomain ( [61.141.77.49]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 07 Jun 2023 17:43:13 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: CR3LFp2JE4mfAn2LSTK1xi8qQ4UyRaoYMHxJsMRywKHgdAG3qZj5i/iI8Gq2F qluTGaMPCQg796dEjFelUhz3yE2cRQpMvoRAnhlccXre+mIYL9qQKu4FMQhAgYBJSweglF9 kr/0leOh4j8oBKxFg2gyyU9V4K8lOvNTc9+IyvSJpknvm0Jzi96r0jlC9kGPAKAOg3NKisU cWrZgto44qMqQuSFpnk1OcEj3Tt/+aCPDl2NgC+RN85mQQVMP0ndJNtF9xySZ9dMSJM1XLq byk1dnIYv3TABQOU5bFFTJIe9OxHppx3H3IykqTdkFIjFRI8u00KYm8ryj+Vx4BSU5xFBNZ 6I11YXK6OZjQJ06s26jew+8E/pe+8Dosv1Fu1grJgVykfNd5N/UZrVsKqjH/WsYVgpQ9RTJ r2CCAVQVlBKzO2SjacAyKA== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 1815332739325030604 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Subject: [PATCH v4 3/3] selftests/nolibc: riscv: customize makefile for rv32 Date: Wed, 7 Jun 2023 17:37:01 +0800 Message-Id: <3698e3629148550146b986cda61539a647ebd589.1686128703.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Both riscv64 and riscv32 have: * the same arch/riscv source code tree * the same tools/include/nolibc/arch-riscv.h * the same ARCH=3Driscv value passed to top-level kernel Makefile The only differences are: * riscv64 uses defconfig, riscv32 uses rv32_defconfig * riscv64 uses qemu-system-riscv64, riscv32 uses qemu-system-riscv32 * riscv32 has different compiler options (-march=3D and -mabi=3D) So, riscv32 can share most of the settings with riscv64, add riscv32 support like the original ARCH=3Driscv support. To align with x86, the default riscv is reserved for riscv64 and a new riscv64 is also added to allow users pass ARCH=3Driscv64 directly. Since top-level kernel Makefile only accept ARCH=3Driscv, to make it happy, let's add a KARCH, set it as riscv for riscv32 and riscv64, and set it as original ARCH for the others, at last pass it to kernel targets with ARCH=3D$(KARCH). The same ARCH=3D$(KARCH) passed to tools/include/nolibc/Makefile, for both arch-riscv.h and the headers_standalone target require it too. Usage: $ make defconfig ARCH=3Driscv32 CROSS_COMPILE=3Driscv64-linux-gnu- ... $ make run ARCH=3Driscv32 CROSS_COMPILE=3Driscv64-linux-gnu- ... Suggested-by: Thomas Wei=C3=9Fschuh Link: https://lore.kernel.org/linux-riscv/4a3b1cdf-91d5-4668-925e-21f8f5c64= a92@t-8ch.de/ Suggested-by: Arnd Bergmann Link: https://lore.kernel.org/linux-riscv/d1c83340-af4c-4780-a101-b9d22b473= 79c@app.fastmail.com/ Suggested-by: Willy Tarreau Link: https://lore.kernel.org/lkml/ZIAywHvr6UB1J4of@1wt.eu/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte= sts/nolibc/Makefile index 4a3a105e1fdf..48fa22817d90 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -14,6 +14,11 @@ include $(srctree)/scripts/subarch.include ARCH =3D $(SUBARCH) endif =20 +# kernel supported ARCH names by architecture +KARCH_riscv32 =3D riscv +KARCH_riscv64 =3D riscv +KARCH =3D $(or $(KARCH_$(ARCH)),$(ARCH)) + # kernel image names by architecture IMAGE_i386 =3D arch/x86/boot/bzImage IMAGE_x86_64 =3D arch/x86/boot/bzImage @@ -21,6 +26,8 @@ IMAGE_x86 =3D arch/x86/boot/bzImage IMAGE_arm64 =3D arch/arm64/boot/Image IMAGE_arm =3D arch/arm/boot/zImage IMAGE_mips =3D vmlinuz +IMAGE_riscv32 =3D arch/riscv/boot/Image +IMAGE_riscv64 =3D arch/riscv/boot/Image IMAGE_riscv =3D arch/riscv/boot/Image IMAGE_s390 =3D arch/s390/boot/bzImage IMAGE_loongarch =3D arch/loongarch/boot/vmlinuz.efi @@ -34,6 +41,8 @@ DEFCONFIG_x86 =3D defconfig DEFCONFIG_arm64 =3D defconfig DEFCONFIG_arm =3D multi_v7_defconfig DEFCONFIG_mips =3D malta_defconfig +DEFCONFIG_riscv32 =3D rv32_defconfig +DEFCONFIG_riscv64 =3D defconfig DEFCONFIG_riscv =3D defconfig DEFCONFIG_s390 =3D defconfig DEFCONFIG_loongarch =3D defconfig @@ -49,6 +58,8 @@ QEMU_ARCH_x86 =3D x86_64 QEMU_ARCH_arm64 =3D aarch64 QEMU_ARCH_arm =3D arm QEMU_ARCH_mips =3D mipsel # works with malta_defconfig +QEMU_ARCH_riscv32 =3D riscv32 +QEMU_ARCH_riscv64 =3D riscv64 QEMU_ARCH_riscv =3D riscv64 QEMU_ARCH_s390 =3D s390x QEMU_ARCH_loongarch =3D loongarch64 @@ -61,6 +72,8 @@ QEMU_ARGS_x86 =3D -M pc -append "console=3DttyS0,9= 600 i8042.noaux panic=3D-1 $( QEMU_ARGS_arm64 =3D -M virt -cpu cortex-a53 -append "panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_arm =3D -M virt -append "panic=3D-1 $(TEST:%=3DNOLIBC_TES= T=3D%)" QEMU_ARGS_mips =3D -M malta -append "panic=3D-1 $(TEST:%=3DNOLIBC_TE= ST=3D%)" +QEMU_ARGS_riscv32 =3D -M virt -append "console=3DttyS0 panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" +QEMU_ARGS_riscv64 =3D -M virt -append "console=3DttyS0 panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_riscv =3D -M virt -append "console=3DttyS0 panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_s390 =3D -M s390-ccw-virtio -m 1G -append "console=3DttyS0= panic=3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_loongarch =3D -M virt -append "console=3DttyS0,115200 panic=3D-= 1 $(TEST:%=3DNOLIBC_TEST=3D%)" @@ -76,6 +89,7 @@ else Q=3D@ endif =20 +CFLAGS_riscv32 =3D -march=3Drv32im -mabi=3Dilp32 CFLAGS_s390 =3D -m64 CFLAGS_STACKPROTECTOR ?=3D $(call cc-option,-mstack-protector-guard=3Dglob= al $(call cc-option,-fstack-protector-all)) CFLAGS ?=3D -Os -fno-ident -fno-asynchronous-unwind-tables -std=3Dc89 \ @@ -117,7 +131,7 @@ sysroot: sysroot/$(ARCH)/include sysroot/$(ARCH)/include: $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot $(QUIET_MKDIR)mkdir -p sysroot - $(Q)$(MAKE) -C ../../../include/nolibc ARCH=3D$(ARCH) OUTPUT=3D$(CURDIR)/= sysroot/ headers_standalone + $(Q)$(MAKE) -C ../../../include/nolibc ARCH=3D$(KARCH) OUTPUT=3D$(CURDIR)= /sysroot/ headers_standalone $(Q)mv sysroot/sysroot sysroot/$(ARCH) =20 nolibc-test: nolibc-test.c sysroot/$(ARCH)/include @@ -141,10 +155,10 @@ initramfs: nolibc-test $(Q)cp nolibc-test initramfs/init =20 defconfig: - $(Q)$(MAKE) -C $(srctree) ARCH=3D$(ARCH) CC=3D$(CC) CROSS_COMPILE=3D$(CRO= SS_COMPILE) mrproper $(DEFCONFIG) prepare + $(Q)$(MAKE) -C $(srctree) ARCH=3D$(KARCH) CC=3D$(CC) CROSS_COMPILE=3D$(CR= OSS_COMPILE) mrproper $(DEFCONFIG) prepare =20 kernel: initramfs - $(Q)$(MAKE) -C $(srctree) ARCH=3D$(ARCH) CC=3D$(CC) CROSS_COMPILE=3D$(CRO= SS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=3D$(CURDIR)/initramfs + $(Q)$(MAKE) -C $(srctree) ARCH=3D$(KARCH) CC=3D$(CC) CROSS_COMPILE=3D$(CR= OSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=3D$(CURDIR)/initramfs =20 # run the tests after building the kernel run: kernel --=20 2.25.1