Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6245354rwd; Wed, 24 May 2023 12:57:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Ikxnc/wvQwwiL8yPhfOWce6oPxH6y4iLbtzdR9uJ1UIh6srNStRQoWA+EDkn1Ou/A09Ls X-Received: by 2002:a05:6a20:918b:b0:10e:d3a0:cddf with SMTP id v11-20020a056a20918b00b0010ed3a0cddfmr1031309pzd.12.1684958269214; Wed, 24 May 2023 12:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684958269; cv=none; d=google.com; s=arc-20160816; b=uKPHOrlPVzEIDnnhdkA0zlWCXDF9L6HkULK4fAo+hWRXbAwpijr2V1hRRto/WTCpaI acB7otpUxB1upxmF2Mx3gzm6qSvhZ9YpzZbbVAoxpNDSH3V+kqVsPHWlQJ0h+Rtj8nv4 ZGJiCNzrfunSq07d09jH8mliiPU92UkQHNN6dg9PdVwfdYd1csdxZ7LiucBDRMC4PXDW qFwvZ/z3MN7nscEePUXRlkf0g1tLLTy3bmcl+6QYcEkJQZfFEmT9W4XymqavF3xmRzj1 Z50i80agQMAcuTPUamWk/xSVv+nlAULS5qug+epKU2KA8QR9L+hVcgDLjlVfaw/WUmFu aHRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=qLJFf1ga3Ysjk8X0QP43QMckZKh5z455fibmqrRvOAM=; b=M/7PPcid35soUVtTrj1Uj84g6pe9hUxuRNPUXUbvEzijTpjrKpNOaarFP5iL1BQXvV 0zLQE2GvBbdwo5Kg8/GuF66/zDizG8esQ8Dt/e6SaN2tCcGb8kzDoXF1iNNK+x4qjNGj HCxyDipFWDMujxpK14Ghj7aOVmjWQ5fM9doBre0RP0Bhv8fFdGf3FXrWccOxSNGObfuV IUe4AJTg381SyKNHm5DE9s8Z0se429Ejv9+MVLWnvL+mqLQtf2rNs1BmfWnFsy/p3rya mo5NqYg0D+3OMH1/583zsZblTvPtkt1c31/YGeU7O2uMVeWV9ORc2S30gZGtjJKIrRWl 0XUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=V5YQaFPe; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x22-20020a656ab6000000b00513973cb8b8si9027743pgu.202.2023.05.24.12.57.28; Wed, 24 May 2023 12:57:49 -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; dkim=pass header.i=@t-8ch.de header.s=mail header.b=V5YQaFPe; 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 S235918AbjEXTt0 (ORCPT + 99 others); Wed, 24 May 2023 15:49:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjEXTtW (ORCPT ); Wed, 24 May 2023 15:49:22 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F874139; Wed, 24 May 2023 12:49:18 -0700 (PDT) Date: Wed, 24 May 2023 21:49:16 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1684957756; bh=ZaelfMuK9nEHZvEYR6H9kLGszov8JzRnhm0N2fM3xgc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V5YQaFPevn8tMPELIZ3rL/vARmEGIWBtjWcHmaPhYF+yDj//no8UtMhib8t1RCkgD 2Qx7BcHZAYGtIOSIglBrEkhtnKk7vUQ+wwzP5FZ4tpjHk02fB++Qe+2p0hXbCVEoF0 7NG4Qy6bNq2lDmpXMc3SwckumYi786BO2HxEJScI= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Zhangjin Wu Cc: w@1wt.eu, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, palmer@dabbelt.com, paul.walmsley@sifive.com Subject: Re: [PATCH 04/13] selftests/nolibc: syscall_args: use __NR_statx for rv32 Message-ID: <09d60dc2-e298-4c22-8e2f-8375861bd9be@t-8ch.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_PASS,T_SCC_BODY_TEXT_LINE, T_SPF_HELO_TEMPERROR 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 On 2023-05-25 01:48:11+0800, Zhangjin Wu wrote: > When compile nolibc-test.c for rv32, we 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 __NR_statx instead: > > Running test 'syscall' > 69 syscall_noargs = 1 [OK] > 70 syscall_args = -1 EFAULT [OK] > > As tools/include/nolibc/sys.h shows, __NR_statx is either not supported > by all platforms, so, both __NR_fstat and __NR_statx are required. > > Btw, the latest riscv libc6-dev package is required, otherwise, we would > also get 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" > > The glibc commit 5b6113d62efa ("RISC-V: Support the 32-bit ABI > implementation") fixed up above error, so, glibc >= 2.33 (who includes > this commit) is required. It seems weird to require limits.h from the system libc at all. The only thing used from there are INT_MAX and INT_MIN. Instead we could define our own versions of INT_MAX and INT_MIN in stdint.h. #ifndef INT_MAX #define INT_MAX __INT_MAX__ #endif #ifndef INT_MIN #define INT_MIN (- __INT_MAX__ - 1) #endif Thomas