Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2405731rwl; Thu, 13 Apr 2023 06:10:29 -0700 (PDT) X-Google-Smtp-Source: AKy350YpURy8RoCGsV5GN1zRLYIe1QfxmsEoeK5vZ3TBSE6tu07P2ZyEMAbClhWnasLEYnAqZ2w+ X-Received: by 2002:a05:6102:3e91:b0:42c:791d:9c61 with SMTP id m17-20020a0561023e9100b0042c791d9c61mr2492906vsv.17.1681391429154; Thu, 13 Apr 2023 06:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681391429; cv=none; d=google.com; s=arc-20160816; b=TUYzAobGGKQ5ErYtrkR2UyG7Fyxfhpfk5D4C/cCyA+OovCRDgOv08+vjsaIem8Yocl /bSogygi4becx6pOO+T98O8mYx1ZI09Y/2TAbqiTgl5EhCamcAadP197e3Ry7BDoKm67 XHactwr2f4kjj6t847cwN5dJe7llP28Vt3ptdBUWVf5cO13EOYgAxea4r7H6fImEMTlV 1z6t1n5imxXXM2wUjLN7gJzYxGeOyPjua2JM3bUIhpg/5kE5u7pg6Z2jZ2PJKj/zQ4P7 RJkxrW3nAqxSLsMRyGQa5GT5JmAldQf4WKr3VfygqmFJwxEbPaV+MX8orubxvAsUJ+wy RRQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:subject :references:in-reply-to:message-id:cc:to:from:dkim-signature:date; bh=Yhv7mCx4Al1gJu1rdYzadILqil9/sKtPjX1Iwoi4Rqo=; b=rPgqKjtbSR+ywkfCs9PNnxZSIzA7lrrVYQbFVLP62X6/uBhcO4Thlgq4bBf40ASjxM mZ1GB9oN08MPJoufpm5BiP9jbQAhngDt8jODbN2cy8Fg9I8xIUzh9YVuPURuACV5izJk z3p5ker8/85xx5PSb505Z7Pf0ibjfHOFWQQQiI/PtE0jAzJZ7g5WOv7zh5PMtdAQT4oq ePIIqmIlHfFWzfMs9ndO+vp3QkhsaQoxCiuiZOVm0sFh5prN5lAOkhSRJ8LoCmSEldVC xUukeGNCVIYqrUXfe8sYhgUSYdqfX4aKMEDUQz4tDPenAkCncUnNKMh9rxCQIMVvzXUn obcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=RXFVlroS; 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 i21-20020a67e2d5000000b0042c71c9cf43si304377vsm.101.2023.04.13.06.10.02; Thu, 13 Apr 2023 06:10:29 -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=@weissschuh.net header.s=mail header.b=RXFVlroS; 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 S230220AbjDMNJi (ORCPT + 99 others); Thu, 13 Apr 2023 09:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbjDMNJh (ORCPT ); Thu, 13 Apr 2023 09:09:37 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99AFA1701; Thu, 13 Apr 2023 06:09:35 -0700 (PDT) Date: Thu, 13 Apr 2023 15:09:27 +0200 (GMT+02:00) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1681391373; bh=Yhv7mCx4Al1gJu1rdYzadILqil9/sKtPjX1Iwoi4Rqo=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=RXFVlroSG3X8lXZs43qURnHkuGCtzOpBDuOcd/vrucBxNqr00ZumcvMOvStWAp4md fxzzWo+Jnj5wIPtcXexd8+BbIl6xG6R1sgkqjJb/eHFdTz95dnj2BR14xBNWp/PVOu gR5Ar0/6hiG2lcQaMd5QfkuySGu6zZKE1G49aTNI= From: linux@weissschuh.net To: Mark Brown Cc: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Willy Tarreau , Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-next@vger.kernel.org Message-ID: In-Reply-To: References: <20230328-nolibc-printf-test-v3-0-ddc79f92efd5@weissschuh.net> <20230328-nolibc-printf-test-v3-3-ddc79f92efd5@weissschuh.net> Subject: Re: [PATCH v3 3/4] tools/nolibc: implement fd-based FILE streams MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 Hi Mark, Apr 12, 2023 17:58:45 Mark Brown : > On Sun, Apr 02, 2023 at 06:04:36PM +0000, Thomas Wei=C3=9Fschuh wrote: > >> This enables the usage of the stream APIs with arbitrary filedescriptors= . >> >> It will be used by a future testcase. > > This breaks the explicit use of standard streams: > >> -static __attribute__((unused)) FILE* const stdin=C2=A0 =3D (FILE*)-3; >> -static __attribute__((unused)) FILE* const stdout =3D (FILE*)-2; >> -static __attribute__((unused)) FILE* const stderr =3D (FILE*)-1; >> +static __attribute__((unused)) FILE* const stdin=C2=A0 =3D (FILE*)(intp= tr_t)~STDIN_FILENO; >> +static __attribute__((unused)) FILE* const stdout =3D (FILE*)(intptr_t)= ~STDOUT_FILENO; >> +static __attribute__((unused)) FILE* const stderr =3D (FILE*)(intptr_t)= ~STDERR_FILENO; > > Nothing in this change (or anything else in the series AFAICT) causes > STDx_FILENO to be declared so we get errors like below in -next when a > kselftest is built with this version of nolibc: These definitions come from "tools/nolibc: add definitions for standard fds". This patch was part of the nolibc stack protector series which is older tha= n this series and went through the same channels. So I'm not sure how one series made it into next and the other didn't. This would also have been noticed by Willy and Paul running their tests. > > clang --target=3Daarch64-linux-gnu -fintegrated-as -Werror=3Dunknown-warn= ing-option -Werror=3Dignored-optimization-argument -Werror=3Doption-ignored= -Werror=3Dunused-command-line-argument --target=3Daarch64-linux-gnu -finte= grated-as -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \ > =C2=A0=C2=A0=C2=A0 -include ../../../../include/nolibc/nolibc.h -I../..\ > =C2=A0=C2=A0=C2=A0 -static -ffreestanding -Wall za-fork.c /tmp/kci/linux/= build/kselftest/arm64/fp/za-fork-asm.o -o /tmp/kci/linux/build/kselftest/ar= m64/fp/za-fork > In file included from :1: > In file included from ./../../../../include/nolibc/nolibc.h:97: > In file included from ./../../../../include/nolibc/arch.h:25: > ./../../../../include/nolibc/arch-aarch64.h:176:35: warning: unknown attr= ibute 'optimize' ignored [-Wunknown-attributes] > void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start= (void) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~ > In file included from :1: > In file included from ./../../../../include/nolibc/nolibc.h:102: > ./../../../../include/nolibc/stdio.h:33:71: error: use of undeclared iden= tifier 'STDIN_FILENO' > static __attribute__((unused)) FILE* const stdin=C2=A0 =3D (FILE*)(intptr= _t)~STDIN_FILENO; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^ > ./../../../../include/nolibc/stdio.h:34:71: error: use of undeclared iden= tifier 'STDOUT_FILENO' > static __attribute__((unused)) FILE* const stdout =3D (FILE*)(intptr_t)~S= TDOUT_FILENO; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^ > ./../../../../include/nolibc/stdio.h:35:71: error: use of undeclared iden= tifier 'STDERR_FILENO' > static __attribute__((unused)) FILE* const stderr =3D (FILE*)(intptr_t)~S= TDERR_FILENO; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^ > 1 warning and 3 errors generated. > > The kselftest branch itself is fine, the issues manifest when it is > merged with the nolibc branch.=C2=A0 I'm not quite sure what the implicit= > include that's been missed here is? These defines should be available to all users of nolibc. It seems more of an issue with the patchsets going through different trees. I can investigate this more tomorrow with my proper development setup. Thomas