From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id D53F8385802C for ; Tue, 11 Jan 2022 12:54:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D53F8385802C Received: by mail-wr1-x42e.google.com with SMTP id d19so2267776wrb.0 for ; Tue, 11 Jan 2022 04:54:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=9x3UOKY9ANbueEK+c4J2/eHfCTa+aM4zh05N+QH0nDo=; b=MUUZ+OIbU5MsgibbFNwKgQuPKhlg2hloq5cqDzRhipcW+gDM5bOv8VlBWN5wWUvSKr 8xh19hZ+vSuImNDrcUdpoVbGAKi3Y3wN5j6s3NofqMlXxwN2MeHwF514JjIZEvODrDZg mqLq+bWzfsXPoqCXhfSiv+Lbnid73V2gSYQRA38JCc2f1N9LGqOf9hINZlY37mrY/bjB F9Ktq6nfLdNXpJ12F4hv1fFequUlIQ5/gccEMj2VaY/kCzNqTbVKn4fbsS1ls/FCQYlE F8rj6qZVkaOdp0Vlp9musyd4T3Bb2+sQ0Mx7439Vg2CZETGnkoO23Q7km2rLhGU6yxS5 i1tQ== X-Gm-Message-State: AOAM5304scMfD2Xea/2RAoMpVhfrqK0VYOzmQNCo8bHvSk/4ggjL2nFG 60BjZaXQh0WVpfb6uaJxJM1e1HZfnK73fAKc/77dbg== X-Google-Smtp-Source: ABdhPJxGLJIwQfcwsyozBJI2p5pJJGxHZUd6bLe5GfnjM4endGEtLcpDHDpZqjHwgGNWofW4AQHZPG0opc4ldDycXe0= X-Received: by 2002:a5d:6848:: with SMTP id o8mr3915228wrw.2.1641905641801; Tue, 11 Jan 2022 04:54:01 -0800 (PST) MIME-Version: 1.0 References: <6238c748-c7f3-159b-0464-2175eb6d1b0a@gmail.com> <877db80yuv.fsf@oldenburg.str.redhat.com> <17BE25E8-4BE6-4F38-AFDE-1DFD28417D5C@sandoe.co.uk> In-Reply-To: <17BE25E8-4BE6-4F38-AFDE-1DFD28417D5C@sandoe.co.uk> From: Eric Gallager Date: Tue, 11 Jan 2022 07:53:50 -0500 Message-ID: Subject: Re: Help with an ABI peculiarity To: Iain Sandoe Cc: Florian Weimer , GCC Development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Tue, 11 Jan 2022 12:54:04 -0000 On Mon, Jan 10, 2022 at 8:28 AM Iain Sandoe wrote: > > Hi Florian, > > > On 10 Jan 2022, at 08:38, Florian Weimer wrote: > > > > * Jeff Law via Gcc: > > > >> Most targets these days use registers for parameter passing and > >> obviously we can run out of registers on all of them. The key > >> property is the size/alignment of the argument differs depending on if > >> it's pass in a register (get promoted) or passed in memory (not > >> promoted). I'm not immediately aware of another ABI with that > >> feature. Though I haven't really gone looking. > > > > I think what AArch64 Darwin does is not compatible with a GCC extension > > that allows calling functions defined with a prototype without it (for > > pre-ISO-C compatibility). > > AFAIU the implementation: > > In the case that a call is built and no prototype is available, the assum= ption 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 h= appen to > observe the same rules in this case. > > It will, however, break once we overflow the number of int regs.. :/ > > =3D=3D=3D=3D > > The case that is fundamentally broken from scratch is of a variadic funct= ion > called without a prototype - since the aarch64-darwin ABI places unnamed > parms differently. > > So that the absence of a prototype causes us to place all args as if they= were > named. > > =3D=3D=3D=3D > > Wmissing-prototype > Wstrict-prototypes > > would wisely be promoted to errors for this platform, Relevant bugs in this area: 82922, add -Wstrict-prototypes to -Wextra: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D82922 91092, Error on implicit function declarations by default: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D91092 (and the related bugs in the "See Also", "Depends On", "Duplicates", etc. fields for each of them) > > (the ABI is obviously not up for change, since it=E2=80=99s already on mi= llions of devices). > > > Given that, anyone defining an ABI in > > parallel with a GCC implementation probably has paused, reconsidered > > what they were doing, > > My guess is that this step was omitted - i.e. the port was designed in th= e LLVM > framework. I can raise a query with the ABI owners, I guess. > > > and adjusted the ABI for K&R compatibility. > > FWIW, we bootstrap sucessfully including the K&R code in intl/ > Given we have 8 int regs available, probably many calls will work .. > > =3D=3D=3D=3D > > As of now, I must assume that what is broken by the cases above will rema= in > broken, and I just need to find a way to implement the cases that will wo= rk (i.e. > when proper prototypes are available) > > thanks > Iain >