From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E15F0385800C for ; Mon, 10 Jan 2022 13:46:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E15F0385800C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-92-JXeW0_YvMd6BycQ2xeaoDw-1; Mon, 10 Jan 2022 08:46:44 -0500 X-MC-Unique: JXeW0_YvMd6BycQ2xeaoDw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81A041006AA6; Mon, 10 Jan 2022 13:46:43 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C4D584D01; Mon, 10 Jan 2022 13:46:42 +0000 (UTC) From: Florian Weimer To: Iain Sandoe Cc: GCC Development Subject: Re: Help with an ABI peculiarity References: <6238c748-c7f3-159b-0464-2175eb6d1b0a@gmail.com> <877db80yuv.fsf@oldenburg.str.redhat.com> <17BE25E8-4BE6-4F38-AFDE-1DFD28417D5C@sandoe.co.uk> Date: Mon, 10 Jan 2022 14:46:40 +0100 In-Reply-To: <17BE25E8-4BE6-4F38-AFDE-1DFD28417D5C@sandoe.co.uk> (Iain Sandoe's message of "Mon, 10 Jan 2022 13:27:58 +0000") Message-ID: <87bl0jya7z.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jan 2022 13:46:47 -0000 * Iain Sandoe: > In the case that a call is built and no prototype is available, the > assumption is that all parms are named. The promotion is then done > according to the C promotion rules. > > [for the number of args that can be passed in int regs] the callee > will happen to observe the same rules in this case. > > It will, however, break once we overflow the number of int regs.. :/ Exactly. > The case that is fundamentally broken from scratch is of a variadic function > called without a prototype - since the aarch64-darwin ABI places unnamed > parms differently. That part is true for powerpc64le as well, due to the caller-provided saved parameter area which only exists with variadic calls. This already happens in very simple cases, like the POSIX open function. The corruption is quite difficult to diagnose, too. 8-( But it's also quite rare to see such bugs. > Given we have 8 int regs available, probably many calls will work .. Oh, I didn't know that so many registers were available. Maybe that's enough to paper over the lack of ABI compatibility for now. Presumably you could count the number of arguments and emit a warning at least? C++ metaprogramming involving many parameters tends to use variadic templates of non-variadic functions, so that shouldn't be a problem. Thanks, Florian