From: Eric Gallager <egall@gwmail.gwu.edu>
To: Iain Sandoe <iain@sandoe.co.uk>
Cc: Florian Weimer <fweimer@redhat.com>, GCC Development <gcc@gcc.gnu.org>
Subject: Re: Help with an ABI peculiarity
Date: Tue, 11 Jan 2022 07:53:50 -0500 [thread overview]
Message-ID: <CAMfHzOvErcwmXuscUYQnieiOobHLsTD9-hjR9gcqV_KVQEYcvw@mail.gmail.com> (raw)
In-Reply-To: <17BE25E8-4BE6-4F38-AFDE-1DFD28417D5C@sandoe.co.uk>
On Mon, Jan 10, 2022 at 8:28 AM Iain Sandoe <iain@sandoe.co.uk> wrote:
>
> Hi Florian,
>
> > On 10 Jan 2022, at 08:38, Florian Weimer <fweimer@redhat.com> 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 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.. :/
>
> ====
>
> 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.
>
> So that the absence of a prototype causes us to place all args as if they were
> named.
>
> ====
>
> 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=82922
91092, Error on implicit function declarations by default:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91092
(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’s already on millions 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 the 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 ..
>
> ====
>
> As of now, I must assume that what is broken by the cases above will remain
> broken, and I just need to find a way to implement the cases that will work (i.e.
> when proper prototypes are available)
>
> thanks
> Iain
>
next prev parent reply other threads:[~2022-01-11 12:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 21:06 Iain Sandoe
2022-01-07 21:55 ` Paul Koning
2022-01-08 16:35 ` Jeff Law
2022-01-10 8:38 ` Florian Weimer
2022-01-10 13:27 ` Iain Sandoe
2022-01-10 13:46 ` Florian Weimer
2022-01-11 12:53 ` Eric Gallager [this message]
2022-01-11 11:57 ` Richard Earnshaw
2022-01-10 10:46 ` Richard Sandiford
2022-01-10 13:06 ` Iain Sandoe
2022-01-20 22:32 ` Richard Sandiford
2022-01-21 11:19 ` Iain Sandoe
2022-01-21 12:22 ` Richard Sandiford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMfHzOvErcwmXuscUYQnieiOobHLsTD9-hjR9gcqV_KVQEYcvw@mail.gmail.com \
--to=egall@gwmail.gwu.edu \
--cc=fweimer@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=iain@sandoe.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).