From patchwork Mon May 29 12:54:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 100244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1490338vqr; Mon, 29 May 2023 05:58:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7C7HqXlxlobhg/WF4FUXatf5kVbqMlt56AlHHfCGKVK42vY5WNHWZVEyp02aoEdXhB6TG+ X-Received: by 2002:a05:6a00:b93:b0:64b:205:dbf3 with SMTP id g19-20020a056a000b9300b0064b0205dbf3mr15886984pfj.34.1685365087329; Mon, 29 May 2023 05:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685365087; cv=none; d=google.com; s=arc-20160816; b=Bboq0+yw02br+gMxTCSmuDpsjwGZKL5V357tTziYH5i2yVXZbVCnsJGJUFvdZsHGrw O4qc+L95GN/75fo2Xy0njAmRI0jfIkF/fm0KohU9cJGqRwJXTPod8YrJpPEE41w1Ktgs SUecFyja33zuiUCww4hD+Sh2FhJTf6TOCm55+SZIg1JPMufpCaVS+iIGyZyAx62TijS5 LhFHk88XccUpbwO8wRBpUfza9rKjVEEnpJUzDC0yj1VhcL7qu9IVtUkxRUmINACuD7TW /J0FJogHR6tU60eCng88lMry/+ake8+CRGe74TdeiqZiZYy4P2o1rL/Ykzsbp6jpGvdT C+6g== 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=h1zk0Bu649ZapJIMZLkoEeuZI6meJg4UkNx4PwNW+EQ=; b=AU2RJiIvbKhjs2qZN1Gg4ljvR3I0tyizOniAfZotD+dVgeulVkS5G/oMDNgBZY6SYq VdPnQM5ZfXylKeeAsm97KFy07z5b1/hwlOTIPB3+XEI+SX6jwXbHZFemy4psRgy6MhjZ z4mYGYQ1lgL/EYSlweYmn4a1+xr4z50RlcBGq01h2anh24P4RTvrvgdoE9DRSVE2jhUK BioV1YR+ZT1mZ1GWel2Zh8G782IZ8C/RxicusXzy5sYG7uyEMi/hf0KCSxelURssO/8P dPRSYFu+sa23bMozGOIi5YinHF80rsjYm5mZx20lPZcKBRe/oEC5uAhxUUhIbX/MOj+U Q6lw== 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 p13-20020aa79e8d000000b0064d43f63156si3288482pfq.354.2023.05.29.05.57.53; Mon, 29 May 2023 05:58:07 -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 S229529AbjE2My4 (ORCPT + 99 others); Mon, 29 May 2023 08:54:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjE2Myz (ORCPT ); Mon, 29 May 2023 08:54:55 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAC82B5; Mon, 29 May 2023 05:54:51 -0700 (PDT) X-QQ-mid: bizesmtp68t1685364882tneg2x8d Received: from linux-lab-host.localdomain ( [119.123.130.80]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 29 May 2023 20:54:41 +0800 (CST) X-QQ-SSF: 00200000000000D0V000000A0000000 X-QQ-FEAT: 3M0okmaRx3gSbqUlMdelesQfurP/ax7t3wqfS40b16enwTCNEPD74koH8ri3v vF1/Uz8gKhJ6aIWLWeHRJaW+NXsMZon13qE8WY3E+I9olyqaYkmE/3o+f9Qo69tCPQ3O7Km Gf35vAVg9cjJVDrHCf6H+AqcGzDVm6L7LVWfChGkYuLculAPsZPMArIO57GsYnjGLqa9Sd/ CCtlm2mUDcbpjGPdMqU8kHPZ3JH+pXGX/8t9bq4Kc0mZQcjg9Pkf0nriZKmTV2M8Zouw0+f emeWCxZi7f6/d6vJKZOSmK6YtQqakQtMlESY48tTRDf4axguS6W+r8GKAl0bW2rejY+5Ck7 KVPsUKt7pUAHOLUq2CAbKSK9kkHHUz8y+O4aTOT8PHK2TjG2mHsvijHKvl6Dw== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 11219330658314727703 From: Zhangjin Wu 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 1/7] selftests/nolibc: syscall_args: use generic __NR_statx Date: Mon, 29 May 2023 20:54:39 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767233382177664860?= X-GMAIL-MSGID: =?utf-8?q?1767233382177664860?= Compiling nolibc-test.c for rv32 got such error: tools/testing/selftests/nolibc/nolibc-test.c:599:57: error: ‘__NR_fstat’ undeclared (first use in this function) 599 | CASE_TEST(syscall_args); EXPECT_SYSER(1, syscall(__NR_fstat, 0, NULL), -1, EFAULT); break; The generic include/uapi/asm-generic/unistd.h used by rv32 doesn't support __NR_fstat, use the more generic __NR_statx instead: Running test 'syscall' 69 syscall_noargs = 1 [OK] 70 syscall_args = -1 EFAULT [OK] __NR_statx has been added from v4.10: a528d35e8bfc ("statx: Add a system call to make enhanced file info available") It has been supported by all of the platforms since at least from v4.20. Fixes: 8e3ab529bef9 ("tools/nolibc/unistd: add syscall()") Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/nolibc-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 7de46305f419..d417ca5d976f 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -621,7 +621,7 @@ int run_syscall(int min, int max) CASE_TEST(write_badf); EXPECT_SYSER(1, write(-1, &tmp, 1), -1, EBADF); break; CASE_TEST(write_zero); EXPECT_SYSZR(1, write(1, &tmp, 0)); break; CASE_TEST(syscall_noargs); EXPECT_SYSEQ(1, syscall(__NR_getpid), getpid()); break; - CASE_TEST(syscall_args); EXPECT_SYSER(1, syscall(__NR_fstat, 0, NULL), -1, EFAULT); break; + CASE_TEST(syscall_args); EXPECT_SYSER(1, syscall(__NR_statx, 0, NULL, 0, 0, NULL), -1, EFAULT); break; case __LINE__: return ret; /* must be last */ /* note: do not set any defaults so as to permit holes above */ From patchwork Mon May 29 12:56:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 100248 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1500310vqr; Mon, 29 May 2023 06:09:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ujPPx+fBtPuQ+x3rkzWc85Dp6fgGsvOhn2j+63ty7uYUClewiNvG0p/7fzRgX5egoCn5J X-Received: by 2002:a17:90a:7021:b0:250:7d1f:938b with SMTP id f30-20020a17090a702100b002507d1f938bmr11463782pjk.23.1685365754412; Mon, 29 May 2023 06:09:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685365754; cv=none; d=google.com; s=arc-20160816; b=sLCy+vJpvT+RKf+D9xDYT2fSp5I6kuIFy17HK4ItnoMzqV440YJHryreCDWKsWwHWa iOIoceLvObFzCxrSax12SrFgirqEOMb6FZFl0LhavCQKdhd+wyDhuwrqRoAWvheBQTo4 H7udC84GP+qiVqLGNGhQgaMdn6eVcfYjT9Och6Axrtu7RFhhsmGpbDxaqz+9yJWmUNSb IJrGVG0eJSGYSRW14dgIyS2RVTrEZVKCXCZkH7qdCvrwCqHId6TcXnm6+t8cHFSwWXfq WzsnjoIF4nc5Y1r9+fROZ1JPVIWKsiCaDolgWK9VJeYdoIVhY0Rc3Mtta877eWvaR6Ao l3+w== 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=+aoTJQ6N9TsD/FyYX7ahqvEGfpVfkCtlZyNhVSuGnGU=; b=gLNga/LO4B3GbSO/wT6LgUbIgEPgidn7Gg0VdfDEP9kWMfhTxsb5TE9XAA5WS7zDVO CzZUBxU0jJeI67PIC2GARAXoQFj7PN1KYyYElZxYObm3dCLbtR8a2JVZkwcuE5NibNLA me6+OsJZ3AOSLM1kGgdfHbVymi2M9kVyMX4wwmZ+wNtlrxRG7T0ZWRfbY8TF7/eEFNfy FoOmMaF955RHQdhT66GBASzlT3v0zIX8Mq2weS6K45Kk5mIhVO/qJAvmiQR694YfPvRz mHj7R5FyZoHu8VI5L2dBYmhKO6YpgA9OGh7IPL1krsB6iQJeX4IZNKacVIMq7XxoTtfk +APg== 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 oe5-20020a17090b394500b00246f8b06125si12898364pjb.108.2023.05.29.06.08.59; Mon, 29 May 2023 06:09:14 -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 S229641AbjE2M4h (ORCPT + 99 others); Mon, 29 May 2023 08:56:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbjE2M4f (ORCPT ); Mon, 29 May 2023 08:56:35 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CDC4DC; Mon, 29 May 2023 05:56:33 -0700 (PDT) X-QQ-mid: bizesmtp70t1685364975tgu8b8nk Received: from linux-lab-host.localdomain ( [119.123.130.80]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 29 May 2023 20:56:14 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: FVl8EHhfVR783a8W9cyjlbwbl8mKgDbq7E9fTAhEP/OvspzBBX5yVruB4eMmw ghv1uWTKdn3WWnfuPirBiJXTDIoLu4+zRicOyy51cEaBDTfX/44GdqG2l5NZILUSeeU6y/V 4nd0bq9QznBIvumYMoPS1IJhTI+h4UZjFJzTkhfnat3GT8dXP6j4ZHLsH7N5xuCxnlR5i+N tViOrP/UytFGRtN5fuWrvTNRAFCFO9vcJkY0hSLR7kWLQqHQlgwIb2njMNj3g9mx/Q3VaKx Wne2knqx3TEbzRHOxPzAikzLPgS8dOE0aAI7qSy+aUfJaB6ijw98ePU52ffTHXNfn+5d2J7 imguZhQn65iyk9XF7fsKZRTLg+vA5KqQtHQty4xBuie5vmK5jd7+JzpqmkwnnSYkYZa6DZl HTaaZ9JP8dI= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 561798749906670459 From: Zhangjin Wu 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, conor@kernel.org Subject: [PATCH v2 2/7] selftests/nolibc: allow specify extra arguments for qemu Date: Mon, 29 May 2023 20:56:08 +0800 Message-Id: <209c75f2c15992e95bca4f6c2f96ef7f23ab3fcc.1685362482.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767234081555078070?= X-GMAIL-MSGID: =?utf-8?q?1767234081555078070?= The opensbi package from Ubuntu 20.04 only provides rv64 firmwares: $ dpkg -S opensbi | grep -E "fw_.*bin|fw_.*elf" | uniq opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.bin opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.bin opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.elf opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf To run this nolibc test for rv32, users must build opensbi or download a prebuilt one from qemu repository: https://gitlab.com/qemu-project/qemu/-/blob/master/pc-bios/opensbi-riscv32-generic-fw_dynamic.bin And then use -bios to tell qemu use it to avoid such failure: $ qemu-system-riscv32 -display none -no-reboot -kernel /path/to/arch/riscv/boot/Image -serial stdio -M virt -append "console=ttyS0 panic=-1" qemu-system-riscv32: Unable to load the RISC-V firmware "opensbi-riscv32-generic-fw_dynamic.bin" To run from makefile, QEMU_ARGS_EXTRA is added to allow pass extra arguments like -bios: $ make run QEMU_ARGS_EXTRA="-bios /path/to/opensbi-riscv32-generic-fw_dynamic.bin" ... Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 47c3c89092e4..44088535682e 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -64,7 +64,7 @@ QEMU_ARGS_mips = -M malta -append "panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_riscv = -M virt -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_s390 = -M s390-ccw-virtio -m 1G -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_loongarch = -M virt -append "console=ttyS0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" -QEMU_ARGS = $(QEMU_ARGS_$(ARCH)) +QEMU_ARGS = $(QEMU_ARGS_$(ARCH)) $(QEMU_ARGS_EXTRA) # OUTPUT is only set when run from the main makefile, otherwise # it defaults to this nolibc directory. From patchwork Mon May 29 13:00:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 100253 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1505565vqr; Mon, 29 May 2023 06:15:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ513tkLRvP9C88sPrexcKeWgTBuZvTOeCLdliDazUOIc06wnwkwEBTaPtMfoHFbXGVtYLqK X-Received: by 2002:a05:6a00:2d2a:b0:64b:256:204c with SMTP id fa42-20020a056a002d2a00b0064b0256204cmr14647259pfb.20.1685366143758; Mon, 29 May 2023 06:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685366143; cv=none; d=google.com; s=arc-20160816; b=ISSVt678pLzdl6yPvZsYzMB5yIJgqN3h/YgYhdbrGqdDELusG078ZcbfwFg7fEGlpZ MPm4OYkpm7XMH70CiBsgHSMa1EDwj/ftC5mGJF28+r8E4KoLWWH55FbNXkEXFxMvgC0r 2gWJ+IwnrLcdlt3Ae/t/ykfxe65dPjofvRqaU+BPLpxC+czJvMVPxxkPWcsU6NQCGUJI Jof10mDZEAzQABISplNbIKFc//uvwG0T17MG8yvAfDCNgJMnQLi7bCYTMmuJ5W6N+2Rh hTsYsc0mdULNIZap+o2xg9/FLHM7ymdKno5P4lpiFMOe1D8eZ65V4ZVFAP/flkzK/wyP nuTA== 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=2iUbdNEOA4z8a2vl+AXpPyf365dTj++T8/CQP6JH7Y0=; b=C98RxzugiLcnds9ZpN0VaW+p9entGyXvZMYu2zMrbcW+D/3DwPnu7Q/3xFdhZw55UF XrfvFylgaOO88mFiheT9iT6q1seZlgtHL4BeiOWB3JlzX5EUSxE7T3n0jCiVcCjJARVJ FpPEh+tgsG/fN3SSrLVmgniPuHXcFM4fW6l02H7Sv74CLT/6HtJo+6FZHlsV5HpHx0Wc pFr3+v9H2gsGmQNbCMUXdnIUSvkdODl5LanSXK/++xcadd1aYcPnR9Ctuok6LPIFyyuJ B2cSX979emh2FonLGyUViF0oNymSwumbj7WJal+g08/iGyheoKezFgqtFB3Pe9bXylEF 03Cg== 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 r20-20020a6560d4000000b0053071414c3asi4232520pgv.562.2023.05.29.06.15.31; Mon, 29 May 2023 06:15:43 -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 S229518AbjE2NAV (ORCPT + 99 others); Mon, 29 May 2023 09:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbjE2NAU (ORCPT ); Mon, 29 May 2023 09:00:20 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D24391; Mon, 29 May 2023 06:00:18 -0700 (PDT) X-QQ-mid: bizesmtp78t1685365209tn304cds Received: from linux-lab-host.localdomain ( [119.123.130.80]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 29 May 2023 21:00:07 +0800 (CST) X-QQ-SSF: 00200000000000D0V000000A0000000 X-QQ-FEAT: rZJGTgY0+YPLNKIjmriA1LyRD/9GVh50DK49bFM+u4kQwihN+a4qP4/e9Lr+I tlmnaNZ+nIUm6A2omPGy/+sSzZrOubvL+5ZvqVr3IsHscrGxbzvQRuwqG7viOZO6b+sh992 HUiH7R5VAiWB6QaViufuoxqSKbNbwowdK7F797RyTOJhl1+JgSrGd+24WyK7eVDXzu83zSv eDNpUtxLJstDd39F4/RIIHuzZzCNldhAlJF4/t0rfGfd1dgRmCa3+IYz/wD7XfyhPtK57Ao Rmvu4usRDG5AyT2Kj66AC6iBUeSMjXIqPJypayw8mcuGFHrB0/PmUIReymTHZVQCZWy2w7j hLj7rV3KyYOR8VuFnHZ7q1HAwSUI7VPcjcPc9a8f6dEHBjOv8+WhJvLFKrnmy9ZVB6+7sNR X-QQ-GoodBg: 0 X-BIZMAIL-ID: 879951463538973120 From: Zhangjin Wu 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 3/7] selftests/nolibc: fix up compile warning with glibc on x86_64 Date: Mon, 29 May 2023 21:00:01 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767234470404613612?= X-GMAIL-MSGID: =?utf-8?q?1767234489613973668?= Compiling nolibc-test.c with gcc on x86_64 got such warning: tools/testing/selftests/nolibc/nolibc-test.c: In function ‘expect_eq’: tools/testing/selftests/nolibc/nolibc-test.c:177:24: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 177 | llen += printf(" = %lld ", expr); | ~~~^ ~~~~ | | | | | uint64_t {aka long unsigned int} | long long int | %ld It because that glibc defines uint64_t as "unsigned long int" when word size (means sizeof(long)) is 64bit (see include/bits/types.h), but nolibc directly use the 64bit "unsigned long long" (see tools/include/nolibc/stdint.h), which is simpler, seems kernel uses it too (include/uapi/asm-generic/int-ll64.h). It is able to do like glibc, defining __WORDSIZE for all of platforms and using "unsigned long int" to define uint64_t when __WORDSIZE is 64bits, but here uses a simpler solution: nolibc always requires %lld to match "unsigned long long", for others, only require %lld when word size is 32bit. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/nolibc-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index d417ca5d976f..7f9b716fd9b1 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -174,7 +174,11 @@ static int expect_eq(uint64_t expr, int llen, uint64_t val) { int ret = !(expr == val); +#if __SIZEOF_LONG__ == 4 || defined(NOLIBC) llen += printf(" = %lld ", expr); +#else + llen += printf(" = %ld ", expr); +#endif pad_spc(llen, 64, ret ? "[FAIL]\n" : " [OK]\n"); return ret; } From patchwork Mon May 29 13:02:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 100254 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1505687vqr; Mon, 29 May 2023 06:15:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4jfinY2WMMPtwUbhXrLiOKZwwrFAI8wj/jpF9DXSZe1O7iX6Cviuim/3+odu5x9Kxh42if X-Received: by 2002:a17:903:1205:b0:1b0:378e:2768 with SMTP id l5-20020a170903120500b001b0378e2768mr5212463plh.7.1685366154243; Mon, 29 May 2023 06:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685366154; cv=none; d=google.com; s=arc-20160816; b=dJ2FPpvGEAop2CQzyiX8MpXQDCLmo0hjr6X/LT320gF6qpqdwaXdYqQAPy46X5e6ok r7pjqZUavSUOpgN0Q6QpFLQm8o0OdWCqNFSEYjzaA2yQKTTN9bvzK281vZD+eo4ClLKj Mb8dv+dTTw5cwQ5JDZBowY0a/X8ET2ZD/LNOKQa2hqf7Ppd3kP7k51Lqbmv8DXct6XmY B0ya9Kb3dEnWi7yocCyltp4rthO/vLkdbbdpxN/cGLMegfbjbymam4KsIZbHs9Qpnugr FQrakAPmx7UrQqa132DZQQyWmOE2csK/8wT7U8zlpx5H0M4axTvBgD9u2ANWxeNkbfC7 75Dw== 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=JRV4zMMxmiAnjbK6gVTC0gS3jzbgIhahUfAkWubtv2Q=; b=uRejiuSxxS9yVMjjNQxdzT/s1NNgADRDnSe9TiZE1p2C9I6biWum/FOfPI9i30i9tX V9peE75/1wBqOFOoRAoYKuNniq9U84IVY8+wrLJxWe6c7n0MhrlUjrGQbIFIJCL2zOua 9zNZ54kH8WQ+9AaK70cPjEv1e4O5sOHBVD+4R0/bTZQrJx3PLQi0cpYi8ZZXE2JRiXDv Ly5xFWqjw3LMWRrpvWWBUze9MdjuCY7CkLV0ONQmi2BpMHuTHjdIZ0/agzQ6P4sAC5wu t9pJxrIk66J0ejpVALGcxWudaqcHJTWEElDH53oO2zW8saSa3eH4mmRuB9MxO4VDYM4A I0yQ== 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 jk12-20020a170903330c00b001b022f2aa16si5417688plb.472.2023.05.29.06.15.41; Mon, 29 May 2023 06:15:54 -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 S229658AbjE2NDE (ORCPT + 99 others); Mon, 29 May 2023 09:03:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229684AbjE2NCf (ORCPT ); Mon, 29 May 2023 09:02:35 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3429C91; Mon, 29 May 2023 06:02:33 -0700 (PDT) X-QQ-mid: bizesmtp87t1685365342tgfgvsv1 Received: from linux-lab-host.localdomain ( [119.123.130.80]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 29 May 2023 21:02:21 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: +oIWmpEafD/1SqjkUeuYFcNqK90OlfDLXNiAJ5k1Wnyer2qCp/+ny5nDVHYkd cX1xZFAq9ucrpyANdNe8Io272fJ0+PuH2kL6v47R6n0t83tJ+VBGkAEef0GGZCPQZ0Q28n8 xezzkkkTRBZ9aLiQwOpMOJPSPD1OfcZ/9CIOqAStBW+TL2qDVJh+bhoNE5vKC0YNcoKjMm6 8rtZojZxswijly3RzFGLsCkIByPwcZPFkmXTZUVdbBRpsn7nEAOjI+pUkIUPLoyVIN3/y8O EqCiltl4ViNyfeFXt2VEKAiPet7iQ3B+/RfP1fk8phhdGDurokqvXrXWvFbgfyAttU3XYMx nhdeFkFQ7oVRIqk/E13oeHTi0HecHF8FK6+Hu5UdmujjQ2GmeCzZhnok3wJ05JEOH7k+32v zEIyK0zQY3k= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 9933290494645403043 From: Zhangjin Wu 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, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Subject: [PATCH v2 4/7] selftests/nolibc: not include limits.h for nolibc Date: Mon, 29 May 2023 21:02:15 +0800 Message-Id: <14a6240d3e5b50760b70d42e9b502e9716c7f2e3.1685362482.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767234500195222168?= X-GMAIL-MSGID: =?utf-8?q?1767234500195222168?= When compile nolibc-test.c with 2.31 glibc, we got such error: In file included from /usr/riscv64-linux-gnu/include/sys/cdefs.h:452, from /usr/riscv64-linux-gnu/include/features.h:461, from /usr/riscv64-linux-gnu/include/bits/libc-header-start.h:33, from /usr/riscv64-linux-gnu/include/limits.h:26, from /usr/lib/gcc-cross/riscv64-linux-gnu/9/include/limits.h:194, from /usr/lib/gcc-cross/riscv64-linux-gnu/9/include/syslimits.h:7, from /usr/lib/gcc-cross/riscv64-linux-gnu/9/include/limits.h:34, from /labs/linux-lab/src/linux-stable/tools/testing/selftests/nolibc/nolibc-test.c:6: /usr/riscv64-linux-gnu/include/bits/wordsize.h:28:3: error: #error "rv32i-based targets are not supported" 28 | # error "rv32i-based targets are not supported" Glibc (>= 2.33) commit 5b6113d62efa ("RISC-V: Support the 32-bit ABI implementation") fixed up above error. As suggested by Thomas, defining INT_MIN/INT_MAX for nolibc can remove the including of limits.h, and therefore no above error. of course, the other libcs still require limits.h, move it to the right place. The LONG_MIN/LONG_MAX are also defined too. Suggested-by: Thomas Weißschuh Link: https://lore.kernel.org/linux-riscv/20230524182431.268908-1-falcon@tinylab.org/T/# Signed-off-by: Zhangjin Wu --- tools/include/nolibc/stdint.h | 14 ++++++++++++++ tools/testing/selftests/nolibc/nolibc-test.c | 4 +--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/include/nolibc/stdint.h b/tools/include/nolibc/stdint.h index c1ce4f5e0603..31a5264539ae 100644 --- a/tools/include/nolibc/stdint.h +++ b/tools/include/nolibc/stdint.h @@ -96,4 +96,18 @@ typedef uint64_t uintmax_t; #define UINT_FAST32_MAX SIZE_MAX #define UINT_FAST64_MAX SIZE_MAX +#ifndef INT_MIN +#define INT_MIN (-__INT_MAX__ - 1) +#endif +#ifndef INT_MAX +#define INT_MAX __INT_MAX__ +#endif + +#ifndef LONG_MIN +#define LONG_MIN (-__LONG_MAX__ - 1) +#endif +#ifndef LONG_MAX +#define LONG_MAX __LONG_MAX__ +#endif + #endif /* _NOLIBC_STDINT_H */ diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 7f9b716fd9b1..e75ce6b68565 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -2,9 +2,6 @@ #define _GNU_SOURCE -/* platform-specific include files coming from the compiler */ -#include - /* libc-specific include files * The program may be built in 3 ways: * $(CC) -nostdlib -include /path/to/nolibc.h => NOLIBC already defined @@ -39,6 +36,7 @@ #include #include #include +#include #endif #endif From patchwork Mon May 29 13:04:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 100252 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1505547vqr; Mon, 29 May 2023 06:15:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dORa+zKhIW+D1KXiE+Ysvi2v8J0uCGqa9najaPhodgnezhl9T/cN4uh+14OeYyMMMo4ZN X-Received: by 2002:a17:90a:dd89:b0:255:2dfc:6c6f with SMTP id l9-20020a17090add8900b002552dfc6c6fmr10358855pjv.24.1685366140977; Mon, 29 May 2023 06:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685366140; cv=none; d=google.com; s=arc-20160816; b=xdKazjTe8a5kRmflpfOkgEe0TmVsxuSWpF71Mxl4k/9ljmr6NFo+qO+ilVWLWlT7hS qILtYld0xRHqZN7rBPV6lIPG7LdWWyTDYrCB33/nEjvB1fSKuYfPGcahE870Km7Gv/oV lGgyrOYl/VresrDVH6ERUxvdkWXjDatMiRdcv4HwN3dvwMKqXcDPgbpMk+5X7KI1hI5M 5MB8V/Y5VXwpwPL1eM1iIan5o3afwgUcuhdEbRRz5HNH61VXoYU+NW2b0h/7uT30LCPH 3TC3qL0KiYPcLz1gNQ9GFNixg0yGg4B5QOKZoF+veF/AUJZfzyQwHcvwAGOKvoo5Caj7 kOiw== 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=UsBdXaItCfmUiZqa4pWoFwQLkEw9SqTjM2ZlPg6sl4I=; b=DioxS1v+RRfwDXG/oSHwXVDzZqufdzIdY3cwmrO8FjgAme94X16di/2yOUjx3TvscZ qar/CVQFztzULXqWh/rTgG346tkmTwtY+385txY93lWglV3XsF1OplBkJnxeg4x+LxVE bFlLMQFm9uCySgs6hX5xfN/r2Gwg1kKbADGtKynKGtKsCx8b04P//fEvdtiQ4DR1ayV3 VyxLWMVKK57aidjns5/c2zuN2VxY2v01fpipWBeaijeFOjL4CGUr4kqlSrrQE09KV8n0 npCzC9z4uto3YIx9M36tfeLKZZFhR1dPeWRZqZfUAZ0Wxqvxlp0OCBoBBbaH/PxER/BY CUNQ== 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 l2-20020a63be02000000b0053467c7b635si4441030pgf.85.2023.05.29.06.15.29; Mon, 29 May 2023 06:15:40 -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 S229683AbjE2NEk (ORCPT + 99 others); Mon, 29 May 2023 09:04:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbjE2NER (ORCPT ); Mon, 29 May 2023 09:04:17 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCF3A9B; Mon, 29 May 2023 06:04:14 -0700 (PDT) X-QQ-mid: bizesmtp88t1685365445t75bgpzp Received: from linux-lab-host.localdomain ( [119.123.130.80]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 29 May 2023 21:04:04 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: i75H2eCteEjnLpMewxVxLDrNbTdZ6XaqgT62xHD7GAxbEuya2/NFVic9wlKR2 a5kdGwQlpfjJNaz/YzSlhC5cSA4kagQIt3PINNuT2Ab6n1K/Gb8hBWDDwrYBCvcAdM5teIy tOKnMd4y8XFqHSNySJdqSIpkhrIGm9rMbckS9jbZuSK8O8MSz+MpEsOvJbYu+MaxqANEIjt vVBzQ1uUopCjGW00WJxlZOp576mh7k5SXdUajNV+l44GGMjwWPAcNDE7bQDJ4oQTtNsnlxk 3AkOBDpTGFve+zAiy1AVAdMk3T6BxmWVv7KhdqlE8eHR7U2/3UDQRZ/couHwg6PX65e1LSr Mlj0aFqMaSpMWk5ZYcCda4bZ5eGDUnulVfBmOJIeJawj0cMpMwj4MMUoH7DHgASCg7DhcO6 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 8875824386806725758 From: Zhangjin Wu 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 5/7] selftests/nolibc: use INT_MAX instead of __INT_MAX__ Date: Mon, 29 May 2023 21:04:02 +0800 Message-Id: <330da9ee27aff3500831a936ffdedc08cc481b63.1685362482.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767234486921928841?= X-GMAIL-MSGID: =?utf-8?q?1767234486921928841?= nolibc now has INT_MAX in stdint.h, so, don't mix INT_MAX and __INT_MAX__, unify them to INT_MAX. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/nolibc-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index e75ce6b68565..9ff9d87cc78e 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -935,7 +935,7 @@ static const struct test test_names[] = { int main(int argc, char **argv, char **envp) { int min = 0; - int max = __INT_MAX__; + int max = INT_MAX; int ret = 0; int err; int idx; @@ -983,7 +983,7 @@ int main(int argc, char **argv, char **envp) * here, which defaults to the full range. */ do { - min = 0; max = __INT_MAX__; + min = 0; max = INT_MAX; value = colon; if (value && *value) { colon = strchr(value, ':'); From patchwork Mon May 29 13:07:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 100259 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1509908vqr; Mon, 29 May 2023 06:22:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7uDM33cw5LpTmOm+cRURLxTO5Dt0mQQtDuqY8TL5vaH0/y1HGDRstuuzRgL4iagH6ngHfH X-Received: by 2002:a17:903:245:b0:1aa:ebaa:51ce with SMTP id j5-20020a170903024500b001aaebaa51cemr15551259plh.14.1685366536286; Mon, 29 May 2023 06:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685366536; cv=none; d=google.com; s=arc-20160816; b=CFy0TBa0UOA2HopScz7f2AjKq1PROiyPpCYO+O9yJQkQrv5EBR+/qj4UM0gm5PAnb/ rjIxL1UQB7m711W0Cb55N3hJMKZgKLJN+gJvCpRuILsDDe40B4cRxg8CmnhHrzz0CYrc AwSrA8vpcEgjJOAHvnwz33c04HcQQ7yD4Zfx2W0zm+3E3EM8d11ZNFXzE0lWNQrzj/5T H3Ue+cBk76C7/BL6SCZA5XZTpu8FA+y4GXHOzRsl9R39eBYybpSU0UUeVR4IKpX12Puf 5CvR6rZZ1pHHkgxP/EyUbj2tfGG22iTxbUeXY2U7cDYrofxwYGgo8Tp8vht9HQ9XECM5 wwSQ== 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=/RFNdUcQHw70d0KcW0LPqqFMcFHeXHUV7LhXYuqd8U0=; b=YbP0uUvcrD4DZX6JM8QlUECqdQgecXhpdCz0+iiSQFUv40JxHzEQ03wrIV6tsBiLvq pEQR+9c8TvIL5LaAhtGSpA4LFEDO/sKAum6pa5E/73/SfRH8N7cjHhI3tRXvYMJ4/hII 5kt04T1WHXp80nYlg1HpBqna48dKUUISk4mWK+A/Udvrjhj19RFganS6fHnWMGOOFmyA CdYN7ZMNUrep0UIb26Uf4/OfziJf3Y+UBIH+HeyrA6OiShGrtHPU1alzmyOJMLIPUN6b 0RNgHhcIur/KXPoEdB5jx4+1dDwcj8E+xkDAW+SmXv9MS+CGGqFRAkNn4so5zdwFnFgE 7gWA== 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 z8-20020a1709028f8800b001a6f0eab385si9592863plo.55.2023.05.29.06.22.04; Mon, 29 May 2023 06:22:16 -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 S229601AbjE2NH7 (ORCPT + 99 others); Mon, 29 May 2023 09:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjE2NH5 (ORCPT ); Mon, 29 May 2023 09:07:57 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 693B091; Mon, 29 May 2023 06:07:55 -0700 (PDT) X-QQ-mid: bizesmtp85t1685365665tgzca5zc Received: from linux-lab-host.localdomain ( [119.123.130.80]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 29 May 2023 21:07:44 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: hvKw+PyJ8U6+uRVu/0AXG0i6+eBsNcwRbz2CZsT5niaVOLEjABKXMEbu2AisN uImWTWIWpl/bgpjuSuZqGv9sxOil3B8sj88KJEHleCbTRcmkdCIZoLB6KuLdqDUTW/bfNHC qcNmAe1dPOSnMPzWdJrTK1Ms82OBZOdRa1pz17Cotzmwgaz+8DZqQVeH3+/EUj/1QaNFLGz b2cbQLpbMgX9/StyBR2UmwLCa8hQ3pd50wYkdVem43lLqUAUknVygFLGVgwnoRvuXt9XlD+ WyFHJ5lc3V/61Lo3BiaP/0HyPHI9bUnvaaUqXjUNVMv/vv4BLH2GeBCvf6tk9glgdi9gP0O rWlZSsaWPXG4mlGnUKp0F+MP099LijaKfcqzPbPVlQN2SixFKEGVRTrwrpVqUAPa09QjuW9 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 13225124570130202105 From: Zhangjin Wu 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 6/7] tools/nolibc: arm: add missing my_syscall6 Date: Mon, 29 May 2023 21:07:42 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767234901576168857?= X-GMAIL-MSGID: =?utf-8?q?1767234901576168857?= This is required by the coming removal of the oldselect and newselect support. pselect6/pselect6_time64 will be used unconditionally, they have 6 arguments. Suggested-by: Arnd Bergmann Link: https://lore.kernel.org/linux-riscv/20230524182431.268908-1-falcon@tinylab.org/T/#t Signed-off-by: Zhangjin Wu --- tools/include/nolibc/arch-arm.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc/arch-arm.h index 45b89ffe8247..ca4c66987497 100644 --- a/tools/include/nolibc/arch-arm.h +++ b/tools/include/nolibc/arch-arm.h @@ -198,6 +198,29 @@ struct sys_stat_struct { _arg1; \ }) +#define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \ +({ \ + register long _num __asm__(_NOLIBC_SYSCALL_REG) = (num); \ + register long _arg1 __asm__ ("r0") = (long)(arg1); \ + register long _arg2 __asm__ ("r1") = (long)(arg2); \ + register long _arg3 __asm__ ("r2") = (long)(arg3); \ + register long _arg4 __asm__ ("r3") = (long)(arg4); \ + register long _arg5 __asm__ ("r4") = (long)(arg5); \ + register long _arg6 __asm__ ("r5") = (long)(arg6); \ + \ + __asm__ volatile ( \ + _NOLIBC_THUMB_SET_R7 \ + "svc #0\n" \ + _NOLIBC_THUMB_RESTORE_R7 \ + : "=r"(_arg1), "=r" (_num) \ + : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \ + "r"(_arg6), "r"(_num) \ + : "memory", "cc", "lr" \ + ); \ + _arg1; \ +}) + + char **environ __attribute__((weak)); const unsigned long *_auxv __attribute__((weak)); From patchwork Mon May 29 13:09:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 100251 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1505418vqr; Mon, 29 May 2023 06:15:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4tAnF+4tu19RUbhN318DJBMaOlOgLBGHB16Hrx7lOPvhe8y27OJp4fcSshJvS4vfNm9mcT X-Received: by 2002:a05:6a20:7f84:b0:103:b436:aef7 with SMTP id d4-20020a056a207f8400b00103b436aef7mr8541751pzj.16.1685366131680; Mon, 29 May 2023 06:15:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685366131; cv=none; d=google.com; s=arc-20160816; b=MURyDKmMQPHjGpJBZ4cO4/I0Zt8HhtsEFRkdH9CUlkB9UgJCpavGzqulL70lfELaI1 3dp9MWA8TcLbqVa8Yn15wL8U2VaorK3m9HFQRqd72Bd2ASyhDwwtnJDeuk/3kR0mc+Tv 0a/aZ+GtXhiv6eqGueV+NXdJ7FDO/1J6s/YtF3Z4T0jEPDUj3stcJjXj5oFWodFZ0Emg hG0+PdOew8Gyqlk+a+2SNFS3B3PA3zEdOk0Fb0167b5bFnUOCHMXz8swJ9Nai4RPMHao S+2K6vQF9o/1uwDuqRy9KFdKJLy/etm0HZgL/ywEJnH7b6XNWiRK/y0bOYFStILZDOvk Dunw== 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=GzSCDr33Bd6d9MmRuyDPCHM2DKRlRZBzRpu2ekOT3GQ=; b=kBnOkCGp/NrVcG5u9M9HZgDZaJbkSZ3xCU8/pjZu4rF0x8HtUSX4TWJjTtqyLgbYzT AD0HKqlXaDJ9GLGcscUtguHx9cmc2gCSKehyr4+7tkX5vGkkQNjz93eGP6xtytll+/wK tM8zHYY0MWjwmdY0bfyeYe61X9gh1uVgvvvi1vYg75dGHANHarha780kKChw8s9KqtLv Jpf3hr2DIC/rJnG4HX+TR+MTkhJVLAXR9Snc8oDQVWZ5qff1cRXAKjbEm5y/plAQ9LQ6 3q8MkXwWSQQ9qmsuiUTjUyNRF1uJlC5A227LPYYhFLUFxFS8Bgkv1CqTg3zXChaXhuMG CyQQ== 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 r3-20020a632b03000000b005342409bdcasi9044258pgr.723.2023.05.29.06.15.19; Mon, 29 May 2023 06:15:31 -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 S229539AbjE2NJa (ORCPT + 99 others); Mon, 29 May 2023 09:09:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjE2NJ2 (ORCPT ); Mon, 29 May 2023 09:09:28 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B5291; Mon, 29 May 2023 06:09:26 -0700 (PDT) X-QQ-mid: bizesmtp84t1685365756twqe4148 Received: from linux-lab-host.localdomain ( [119.123.130.80]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 29 May 2023 21:09:15 +0800 (CST) X-QQ-SSF: 00200000000000D0V000000A0000000 X-QQ-FEAT: c42nD1GNGymYSx9zxbwKVxV026O2dZWRFqYx6VQqJt6skveeHg/nZbB/cHuZH yNePeKtpfxiGhlrCiFRwsT41pB2wFLQqVPZ421ScXWSPm8WuUHiCwKQ49QH9580QgRZllK6 kAaElYyTFvBbXqR/lhLnOXSQU22pnZim6le3759YqTcbbL+WXrujyuMlMXr+Cv7uv5MfKF6 nBKBBATqyNtj0st9oDj0zF6U8qzqutCKNead501b7xS5i8jYxBc+F1Kmsrh2H/3f4IEt1us tqatwCDcOYeFimS8rExKu652H6GDc/H/Xf8uMN37CFoDjdnnuyNoXEv2T9EAudaLLCF3+PA QCv95hQ/2kQXzkSSYDxg3fBIEf3ZGyBGoPJieoMnz2Vcro6q28= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 16574069139898678745 From: Zhangjin Wu 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 7/7] tools/nolibc: open: fix up compile warning for arm Date: Mon, 29 May 2023 21:09:09 +0800 Message-Id: <63248d72857cd6e40f997b0893e865faeab2d40e.1685362482.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767234476872380501?= X-GMAIL-MSGID: =?utf-8?q?1767234476872380501?= In function ‘open’: nolibc/sysroot/arm/include/sys.h:919:23: warning: ‘mode_t’ {aka ‘short unsigned int’} is promoted to ‘int’ when passed through ‘...’ 919 | mode = va_arg(args, mode_t); | ^ nolibc/sysroot/arm/include/sys.h:919:23: note: (so you should pass ‘int’ not ‘mode_t’ {aka ‘short unsigned int’} to ‘va_arg’) nolibc/sysroot/arm/include/sys.h:919:23: note: if this code is reached, the program will abort Signed-off-by: Zhangjin Wu --- tools/include/nolibc/sys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 1d6f33f58629..154194056962 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -862,7 +862,7 @@ int open(const char *path, int flags, ...) va_list args; va_start(args, flags); - mode = va_arg(args, mode_t); + mode = va_arg(args, int); va_end(args); }