Message ID | 6f065441a6be9e63238ffb3d43cf09a6e4ac6773.1685387485.git.falcon@tinylab.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1749553vqr; Mon, 29 May 2023 13:24:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7CyPnfC4OnyzU1yARfp52iJDuEPPWX6EO5k4W4QF827MzTsPUjDD773g5pXKG2dPuBSWs6 X-Received: by 2002:a05:6a00:2286:b0:64f:4812:8c7e with SMTP id f6-20020a056a00228600b0064f48128c7emr772889pfe.19.1685391882223; Mon, 29 May 2023 13:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685391882; cv=none; d=google.com; s=arc-20160816; b=Z2AcM9yh+c/gOuJ4Q7ZOdbXEBy2aud3LGuW3UQSAlg7exJUYwuIQe8XU5TlDMDZukP 8+OCrWYOaNaREOtxTOAooN85e1YM6ZT0yh2nmpVkOUD1Zpi8BGDx8zg8qDhH42BXJvKz zJbJJN2Ot0ltSj6RbKANGzG6AAR2sqYwepGB8xQK5ix5/vjGkyxv5WepqakWh2L+PHZF XmaYn7ybP+IuIeIQsBBIY7mDabYkd07xXtGE7QeTaWsS5ZuEDo9XLW5X3eWqugApiZ3X Q1kKoMtqBwgQWzzLtYRGlOTQJ5MA77aNIe7+h80ia+Y4hSva81VUprFL9rXr1o5NPwpv PkRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=gX4AfOyJup75LmHV5wYu1sRCOofHccLskUccHenZpkM=; b=iuL3qFiU0xDCMw9fUE2NmgYAyGrqSDt6b2Fkx03ekMB+a83hqF/hUe/xwpaO2+6/E/ xynpz9nLXQ1aCJQzqshXGEWRQNEfoaSNv4GXwq/CQbV1VkonEOEtUS054t1PS17gFS/b 2HZAOaoinTkkqnv1tuhjXr36RTrUTpzqWFJUuvnLhZZez/gjs9IutOVMzy3JL0j/RZpy UyQFs1a3DPrPvbNL91thWb1XdOxtQvIpIHVt63ui4rfRgZXKvxfGfiw7IcvEgIYSuTSD gZGpSHKoXn4UrZAWciGOGlYtcg54GROiQ2hHHH1kV5QMlmNMze+3x+99E8zgKNOdhHsa 7LLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020aa78bc3000000b0064f40b7c96fsi394115pfd.364.2023.05.29.13.24.30; Mon, 29 May 2023 13:24:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbjE2UDb (ORCPT <rfc822;callmefire3@gmail.com> + 99 others); Mon, 29 May 2023 16:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjE2UDa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 29 May 2023 16:03:30 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED1E2B7; Mon, 29 May 2023 13:03:28 -0700 (PDT) X-QQ-mid: bizesmtp69t1685390599tn4jgnkv Received: from linux-lab-host.localdomain ( [119.123.130.80]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 30 May 2023 04:03:18 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: k0mQ4ihyJQNl0tPjdjOgNqX0jjoVkxp1GSPuWGQl656yikeNBviNJKBitUkp6 lm+aMUjEhrGBVafJe/0RXm005dmvPr0svXZCa00fN2INLXf8FnX81RmDUt2RhzUgAQmcJaY X/4en6armYsi4js8RQbWSj7MXj+1rrUUZu0TBjhA9ohK0H0sNutaoVfQBevgcxiUkv87vvL +//jtz8F0e5Q0CYbDrwZ5uz07UcKaxwX0zS7KvhqZyM0K2PQzxduLNZPan30L2AVmLACHeh eURVC7zC4QyiX2NfPz2+tAWb4UnLZt1DZtzFcv2zFEbXFBGRgAzzEve+INc5O82EGXUTX6q Jn2upXB9ZPMongQJPWwow/0kN1eZf1RBE53Rw0kETzF1NOKT5hNlIbUUAZG6V5q2HzXpa8i X-QQ-GoodBg: 0 X-BIZMAIL-ID: 5246615934604989803 From: Zhangjin Wu <falcon@tinylab.org> To: w@1wt.eu Cc: arnd@arndb.de, falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, thomas@t-8ch.de Subject: [PATCH v2 13/13] selftests/nolibc: riscv: customize makefile for rv32 Date: Tue, 30 May 2023 04:03:13 +0800 Message-Id: <6f065441a6be9e63238ffb3d43cf09a6e4ac6773.1685387485.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <cover.1685387484.git.falcon@tinylab.org> References: <cover.1685387484.git.falcon@tinylab.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767261478282612961?= X-GMAIL-MSGID: =?utf-8?q?1767261478282612961?= |
Series |
nolibc: add part2 of support for rv32
|
|
Commit Message
Zhangjin Wu
May 29, 2023, 8:03 p.m. UTC
Both riscv64 and riscv32 have:
* the same ARCH value, it is riscv
* the same arch/riscv source code tree
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= and -mabi=)
So, riscv32 can share most of the settings with riscv64, there is no
need to add it as a whole new architecture but just need a flag to
record and reflect the difference.
The 32bit mips and loongarch may be able to use the same method, so,
let's use a meaningful flag: CONFIG_32BIT. If required in the future,
this flag can also be automatically loaded from
include/config/auto.conf.
With this patch, it is able to run nolibc test for rv32 like this:
$ make run ARCH=riscv32 CROSS_COMPILE=riscv64-linux-gnu- ...
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
tools/testing/selftests/nolibc/Makefile | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
Comments
Willy, Arnd and Thomas Based on your suggestions, in the comming v3, I plan to split the whole rv32 support to something like this: 1. Generic part1 (The old feedbacks are applied with the new Suggested-by lines, welcome your additional feedbacks if there are ;-)) selftests/nolibc: syscall_args: use generic __NR_statx tools/nolibc: add missing nanoseconds support for __NR_statx selftests/nolibc: allow specify extra arguments for qemu selftests/nolibc: fix up compile warning with glibc on x86_64 selftests/nolibc: not include limits.h for nolibc selftests/nolibc: use INT_MAX instead of __INT_MAX__ tools/nolibc: arm: add missing my_syscall6 tools/nolibc: open: fix up compile warning for arm selftests/nolibc: support two errnos with EXPECT_SYSER2() selftests/nolibc: remove gettimeofday_bad1/2 completely selftests/nolibc: add new gettimeofday test cases 2. Add Compile support for rv32 (Convert all of the unsupported syscalls to a return of -ENOSYS, this allows us to fix up the test failures one by one not that urgently later) tools/nolibc: fix up #error compile failures with -ENOSYS tools/nolibc: fix up undeclared syscall macros with #ifdef and -ENOSYS selftests/nolibc: riscv: customize makefile for rv32 (The first two are new but clear enough, based on the idea of suggestion from Arnd [1]) 3. Fix up the left test failures one by one (Plan to add everyone as a standalone patchset, which will easier the review and merge progress) wait4 -> waitid lseek -> llseek gettimeofday -> clock_gettime/clock_gettime64 select -> pselect6/pselect6_time64 ppoll -> ppoll_time64 4. Clean up some old test cases one by one Like statx ... Best regards, Zhangjin [1]: https://lore.kernel.org/linux-riscv/5e7d2adf-e96f-41ca-a4c6-5c87a25d4c9c@app.fastmail.com/ > Both riscv64 and riscv32 have: > > * the same ARCH value, it is riscv > * the same arch/riscv source code tree > > 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= and -mabi=) > > So, riscv32 can share most of the settings with riscv64, there is no > need to add it as a whole new architecture but just need a flag to > record and reflect the difference. > > The 32bit mips and loongarch may be able to use the same method, so, > let's use a meaningful flag: CONFIG_32BIT. If required in the future, > this flag can also be automatically loaded from > include/config/auto.conf. > > With this patch, it is able to run nolibc test for rv32 like this: > > $ make run ARCH=riscv32 CROSS_COMPILE=riscv64-linux-gnu- ... > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > --- > tools/testing/selftests/nolibc/Makefile | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > index 44088535682e..ea434a0acdc1 100644 > --- a/tools/testing/selftests/nolibc/Makefile > +++ b/tools/testing/selftests/nolibc/Makefile > @@ -14,6 +14,12 @@ include $(srctree)/scripts/subarch.include > ARCH = $(SUBARCH) > endif > > +# Allow pass ARCH=riscv|riscv32|riscv64, riscv implies riscv64 > +ifneq ($(findstring xriscv,x$(ARCH)),) > + CONFIG_32BIT := $(if $(findstring 32x,$(ARCH)x),1) > + override ARCH := riscv > +endif > + > # kernel image names by architecture > IMAGE_i386 = arch/x86/boot/bzImage > IMAGE_x86_64 = arch/x86/boot/bzImage > @@ -34,7 +40,7 @@ DEFCONFIG_x86 = defconfig > DEFCONFIG_arm64 = defconfig > DEFCONFIG_arm = multi_v7_defconfig > DEFCONFIG_mips = malta_defconfig > -DEFCONFIG_riscv = defconfig > +DEFCONFIG_riscv = $(if $(CONFIG_32BIT),rv32_defconfig,defconfig) > DEFCONFIG_s390 = defconfig > DEFCONFIG_loongarch = defconfig > DEFCONFIG = $(DEFCONFIG_$(ARCH)) > @@ -49,7 +55,7 @@ QEMU_ARCH_x86 = x86_64 > QEMU_ARCH_arm64 = aarch64 > QEMU_ARCH_arm = arm > QEMU_ARCH_mips = mipsel # works with malta_defconfig > -QEMU_ARCH_riscv = riscv64 > +QEMU_ARCH_riscv = $(if $(CONFIG_32BIT),riscv32,riscv64) > QEMU_ARCH_s390 = s390x > QEMU_ARCH_loongarch = loongarch64 > QEMU_ARCH = $(QEMU_ARCH_$(ARCH)) > @@ -76,6 +82,7 @@ else > Q=@ > endif > > +CFLAGS_riscv = $(if $(CONFIG_32BIT),-march=rv32i -mabi=ilp32) > CFLAGS_s390 = -m64 > CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all)) > CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \ > -- > 2.25.1
On 2023-06-02 12:06:25+0800, Zhangjin Wu wrote: > Willy, Arnd and Thomas > > Based on your suggestions, in the comming v3, I plan to split the whole rv32 > support to something like this: Is each of these parts a new patchset? I would suggest to do so. > 1. Generic part1 > > (The old feedbacks are applied with the new Suggested-by lines, welcome your > additional feedbacks if there are ;-)) > > selftests/nolibc: syscall_args: use generic __NR_statx > tools/nolibc: add missing nanoseconds support for __NR_statx > selftests/nolibc: allow specify extra arguments for qemu > selftests/nolibc: fix up compile warning with glibc on x86_64 > selftests/nolibc: not include limits.h for nolibc > selftests/nolibc: use INT_MAX instead of __INT_MAX__ > tools/nolibc: arm: add missing my_syscall6 > tools/nolibc: open: fix up compile warning for arm > selftests/nolibc: support two errnos with EXPECT_SYSER2() > selftests/nolibc: remove gettimeofday_bad1/2 completely > selftests/nolibc: add new gettimeofday test cases These all look good and non-controversial. > 2. Add Compile support for rv32 > > (Convert all of the unsupported syscalls to a return of -ENOSYS, this > allows us to fix up the test failures one by one not that urgently later) > > tools/nolibc: fix up #error compile failures with -ENOSYS > tools/nolibc: fix up undeclared syscall macros with #ifdef and -ENOSYS These should be their own series in my opinion. It will likely generate some discussion. > selftests/nolibc: riscv: customize makefile for rv32 > > (The first two are new but clear enough, based on the idea of suggestion from Arnd [1]) > > 3. Fix up the left test failures one by one I'm not a fan of adding an "official" rv32 support with still failing tests. > (Plan to add everyone as a standalone patchset, which will easier the review > and merge progress) > > wait4 -> waitid > lseek -> llseek > gettimeofday -> clock_gettime/clock_gettime64 > select -> pselect6/pselect6_time64 > ppoll -> ppoll_time64 I guess these new codepaths will also be used on non-rv32 architectures and will therefore validated without rv32. So you could submit these before the final rv32 patch in a series. > 4. Clean up some old test cases one by one > > Like statx ... > > Best regards, > Zhangjin > > [1]: https://lore.kernel.org/linux-riscv/5e7d2adf-e96f-41ca-a4c6-5c87a25d4c9c@app.fastmail.com/ > > > Both riscv64 and riscv32 have: > > > > * the same ARCH value, it is riscv > > * the same arch/riscv source code tree > > > > 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= and -mabi=) > > > > So, riscv32 can share most of the settings with riscv64, there is no > > need to add it as a whole new architecture but just need a flag to > > record and reflect the difference. > > > > The 32bit mips and loongarch may be able to use the same method, so, > > let's use a meaningful flag: CONFIG_32BIT. If required in the future, > > this flag can also be automatically loaded from > > include/config/auto.conf. > > > > With this patch, it is able to run nolibc test for rv32 like this: > > > > $ make run ARCH=riscv32 CROSS_COMPILE=riscv64-linux-gnu- ... > > > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > > --- > > tools/testing/selftests/nolibc/Makefile | 11 +++++++++-- > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > > index 44088535682e..ea434a0acdc1 100644 > > --- a/tools/testing/selftests/nolibc/Makefile > > +++ b/tools/testing/selftests/nolibc/Makefile > > @@ -14,6 +14,12 @@ include $(srctree)/scripts/subarch.include > > ARCH = $(SUBARCH) > > endif > > > > +# Allow pass ARCH=riscv|riscv32|riscv64, riscv implies riscv64 > > +ifneq ($(findstring xriscv,x$(ARCH)),) > > + CONFIG_32BIT := $(if $(findstring 32x,$(ARCH)x),1) > > + override ARCH := riscv > > +endif > > + > > # kernel image names by architecture > > IMAGE_i386 = arch/x86/boot/bzImage > > IMAGE_x86_64 = arch/x86/boot/bzImage > > @@ -34,7 +40,7 @@ DEFCONFIG_x86 = defconfig > > DEFCONFIG_arm64 = defconfig > > DEFCONFIG_arm = multi_v7_defconfig > > DEFCONFIG_mips = malta_defconfig > > -DEFCONFIG_riscv = defconfig > > +DEFCONFIG_riscv = $(if $(CONFIG_32BIT),rv32_defconfig,defconfig) > > DEFCONFIG_s390 = defconfig > > DEFCONFIG_loongarch = defconfig > > DEFCONFIG = $(DEFCONFIG_$(ARCH)) > > @@ -49,7 +55,7 @@ QEMU_ARCH_x86 = x86_64 > > QEMU_ARCH_arm64 = aarch64 > > QEMU_ARCH_arm = arm > > QEMU_ARCH_mips = mipsel # works with malta_defconfig > > -QEMU_ARCH_riscv = riscv64 > > +QEMU_ARCH_riscv = $(if $(CONFIG_32BIT),riscv32,riscv64) > > QEMU_ARCH_s390 = s390x > > QEMU_ARCH_loongarch = loongarch64 > > QEMU_ARCH = $(QEMU_ARCH_$(ARCH)) > > @@ -76,6 +82,7 @@ else > > Q=@ > > endif > > > > +CFLAGS_riscv = $(if $(CONFIG_32BIT),-march=rv32i -mabi=ilp32) > > CFLAGS_s390 = -m64 > > CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all)) > > CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \ > > -- > > 2.25.1 >
> On 2023-06-02 12:06:25+0800, Zhangjin Wu wrote: > > Willy, Arnd and Thomas > > > > Based on your suggestions, in the comming v3, I plan to split the whole rv32 > > support to something like this: > > Is each of these parts a new patchset? Yeah, It is also my plan, just like the v2 series. > I would suggest to do so. > > > 1. Generic part1 > > > > (The old feedbacks are applied with the new Suggested-by lines, welcome your > > additional feedbacks if there are ;-)) > > > > selftests/nolibc: syscall_args: use generic __NR_statx > > tools/nolibc: add missing nanoseconds support for __NR_statx > > selftests/nolibc: allow specify extra arguments for qemu > > selftests/nolibc: fix up compile warning with glibc on x86_64 > > selftests/nolibc: not include limits.h for nolibc > > selftests/nolibc: use INT_MAX instead of __INT_MAX__ > > tools/nolibc: arm: add missing my_syscall6 > > tools/nolibc: open: fix up compile warning for arm > > selftests/nolibc: support two errnos with EXPECT_SYSER2() > > selftests/nolibc: remove gettimeofday_bad1/2 completely > > selftests/nolibc: add new gettimeofday test cases > > These all look good and non-controversial. > > > 2. Add Compile support for rv32 > > > > (Convert all of the unsupported syscalls to a return of -ENOSYS, this > > allows us to fix up the test failures one by one not that urgently later) > > > > tools/nolibc: fix up #error compile failures with -ENOSYS > > tools/nolibc: fix up undeclared syscall macros with #ifdef and -ENOSYS > > These should be their own series in my opinion. > It will likely generate some discussion. The 1st one is not rv32 specific, but the 2nd one requires rv32 compile support to be validated. > > > selftests/nolibc: riscv: customize makefile for rv32 > > > > (The first two are new but clear enough, based on the idea of suggestion from Arnd [1]) > > > > 3. Fix up the left test failures one by one > > I'm not a fan of adding an "official" rv32 support with still failing > tests. > That is reasonable, but in another side, without the rv32 compile support, It may be a little hard to test the left patchsets (see below explain). The other reasons for rv32 compile support is: * Some people may use nolibc without the left syscalls. * It is able to detect the new test failures. But anyway, the compile support is not urgent. > > (Plan to add everyone as a standalone patchset, which will easier the review > > and merge progress) > > > > wait4 -> waitid > > lseek -> llseek > > gettimeofday -> clock_gettime/clock_gettime64 > > select -> pselect6/pselect6_time64 > > ppoll -> ppoll_time64 > > I guess these new codepaths will also be used on non-rv32 architectures > and will therefore validated without rv32. > Unfortunately, most of them are time32 syscalls related (except the llseek), rv32 is the first architecture who has no kernel side time32 syscalls support, that's why I plan to add compile support at first ;-) If the new time64 syscalls will be added as the first 'branch', then, they will be validated on the other 32bit architecture, but some of them may be not added as the first 'branch', for example, the waitid() emulated wait4() is bigger than the original one. > So you could submit these before the final rv32 patch in a series. > Thanks for your suggestion. I'm working on cleaning up them independently and carefully, will send them out as standalone patchsets. Best regards, Zhangjin > > 4. Clean up some old test cases one by one > > > > Like statx ... > > > > Best regards, > > Zhangjin > > > > [1]: https://lore.kernel.org/linux-riscv/5e7d2adf-e96f-41ca-a4c6-5c87a25d4c9c@app.fastmail.com/
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 44088535682e..ea434a0acdc1 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -14,6 +14,12 @@ include $(srctree)/scripts/subarch.include ARCH = $(SUBARCH) endif +# Allow pass ARCH=riscv|riscv32|riscv64, riscv implies riscv64 +ifneq ($(findstring xriscv,x$(ARCH)),) + CONFIG_32BIT := $(if $(findstring 32x,$(ARCH)x),1) + override ARCH := riscv +endif + # kernel image names by architecture IMAGE_i386 = arch/x86/boot/bzImage IMAGE_x86_64 = arch/x86/boot/bzImage @@ -34,7 +40,7 @@ DEFCONFIG_x86 = defconfig DEFCONFIG_arm64 = defconfig DEFCONFIG_arm = multi_v7_defconfig DEFCONFIG_mips = malta_defconfig -DEFCONFIG_riscv = defconfig +DEFCONFIG_riscv = $(if $(CONFIG_32BIT),rv32_defconfig,defconfig) DEFCONFIG_s390 = defconfig DEFCONFIG_loongarch = defconfig DEFCONFIG = $(DEFCONFIG_$(ARCH)) @@ -49,7 +55,7 @@ QEMU_ARCH_x86 = x86_64 QEMU_ARCH_arm64 = aarch64 QEMU_ARCH_arm = arm QEMU_ARCH_mips = mipsel # works with malta_defconfig -QEMU_ARCH_riscv = riscv64 +QEMU_ARCH_riscv = $(if $(CONFIG_32BIT),riscv32,riscv64) QEMU_ARCH_s390 = s390x QEMU_ARCH_loongarch = loongarch64 QEMU_ARCH = $(QEMU_ARCH_$(ARCH)) @@ -76,6 +82,7 @@ else Q=@ endif +CFLAGS_riscv = $(if $(CONFIG_32BIT),-march=rv32i -mabi=ilp32) CFLAGS_s390 = -m64 CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all)) CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \