From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id B5F033858D1E for ; Tue, 4 Apr 2023 12:12:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B5F033858D1E Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1680610347; bh=RsapwUOLprVjbynLFKjHuJS43DbgRWhalVHcve1zGK8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=i0549kk0T0nTEBGHPkVo1OdcZKS9Q86TfzOmsYymmN7yy1M8zJ/gdG/mL5+1obVrp QZOB/kSeCj5q62cior45sYFhfJ1/eyymAFkLb1T+OcYKDQ26+Jf/w9l11xdBr7Q50X 3J+be6u9D43bUvdjc1yuplm296XqgzPUU25wVqus= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 7596C66359; Tue, 4 Apr 2023 08:12:25 -0400 (EDT) Message-ID: <59e912949775a0383dc63653a7a031a477faa272.camel@xry111.site> Subject: Re: [PATCH v2 0/5] linux: Avoid va_list for generic syscall wrappers if possible From: Xi Ruoyao To: caiyinyu , Carlos O'Donell , libc-alpha@sourceware.org Cc: Wang Xuerui , Adhemerval Zanella Netto , Andreas Schwab , Florian Weimer Date: Tue, 04 Apr 2023 20:12:23 +0800 In-Reply-To: References: <20230325140815.4170296-1-xry111@xry111.site> <98295b42-c079-c32c-31d6-bb45013342ee@redhat.com> <61ab954501daa24eed8e05638d1c2aec18a941a0.camel@xry111.site> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 2023-04-04 at 09:25 +0800, caiyinyu wrote: >=20 > =E5=9C=A8 2023/3/27 =E4=B8=8B=E5=8D=8810:45, Xi Ruoyao =E5=86=99=E9=81=93= : > > On Mon, 2023-03-27 at 10:04 -0400, Carlos O'Donell wrote: > >=20 > > > In summary, I think this is a compiler problem > > Definitely true. > >=20 > > > and that working around this in glibc > > > is going to result in: > > >=20 > > > - Odd corner case ABI issues between public declarations of variadic > > > functions and > > > =C2=A0=C2=A0 internal non-variadic definitions. > > >=20 > > > - Poorer testing of #else code that uses variadic arguments, as the > > > public interface > > > =C2=A0=C2=A0 requires. > > >=20 > > > I don't support going in this direction. > > Valid reasons.=C2=A0 Abandon this series then. > >=20 > > But I hope these could be raised earlier (in the discussion about > > LoongArch syscall.S) so I wouldn't write all the code :). > >=20 > > > Is there an alternative that could generate better code that doesn't > > > go this way? > > For LoongArch I can improve GCC to save only the GARs containing the > > arguments really used in va_arg (i.e. one GAR for things like open() or > > fcntl() instead of all 8 GARs), but I guess the patch will be delayed > > into GCC 14. > >=20 > > Generally I've not got an idea about how to make GCC avoid saving GARs > > unnecessarily with va_arg. >=20 > So I believe that the assembly implementation of syscalls is still=20 > necessary, especially for users who are using GCC<=3D13. Maybe we can use a custom C implementation (like RISC-V) as well. But strictly speaking the RISC-V syscall.c is invoking undefined behavior (like my proposal) so I agree with assembly here. > patch: >=20 > https://sourceware.org/pipermail/libc-alpha/2023-March/146588.html >=20 --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University