qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>, Brad Smith <brad@comstyle.com>
Subject: Re: [PATCH] tcg/ppc: Fix building with Clang
Date: Thu, 22 Apr 2021 10:20:39 +0100	[thread overview]
Message-ID: <CAFEAcA9TaxkByWscOa2WC=o6fXAxaqAUt30CUsmA24jZ6HEYEA@mail.gmail.com> (raw)
In-Reply-To: <1ebc5a66-2763-1379-24e0-774739f2edbe@linaro.org>

On Thu, 22 Apr 2021 at 06:18, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 4/21/21 2:03 AM, Peter Maydell wrote:
> >> +/* Clang does not define _CALL_* */
> >> +#if defined(__clang__) && defined(__ELF__) && !defined(_CALL_SYSV)
> >> +#define _CALL_SYSV 1
> >> +#endif
> >
> > This is trying to identify the calling convention used by the OS.
> > That's not purely compiler specific (ie it is not the case that
> > all ELF output from clang is definitely using the calling convention
> > that _CALL_SYSV implies), so settign it purely based on "this is clang
> > producing ELF files" doesn't seem right.
>
> We can get pretty close though.  There are three ppc32 calling conventions:
> AIX, DARWIN, SYSV.  The _CALL_ELF symbol is a 64-bit thing, and AIX itself
> doesn't use ELF.
>
> > I guess if clang doesn't reliably tell us the calling convention
> > maybe we should scrap the use of _CALL_SYSV and _CALL_ELF and
> > use the host OS defines to guess the calling convention ?
>
> No, I'd rely on _CALL_* first, and only fall back to something else if they're
> not present.
>
> I'm thinking something like
>
> #if !defined(_CALL_SYSV) && \
>      !defined(_CALL_DARWIN) && \
>      !defined(_CALL_AIX) && \
>      !defined(_CALL_ELF)
> # if defined(__APPLE__)
> #  define _CALL_DARWIN
> # elif defined(__ELF__) && TCG_TARGET_REG_BITS == 32
> #  define _CALL_SYSV
> # else
> #  error "Unknown ABI"
> # endif
> #endif

Doesn't this also need some case that handles "64bit ppc clang which doesn't
define _CALL_anything" ?

thanks
-- PMM


  reply	other threads:[~2021-04-22  9:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21  1:14 [PATCH] tcg/ppc: Fix building with Clang Brad Smith
2021-04-21  9:03 ` Peter Maydell
2021-04-22  5:18   ` Richard Henderson
2021-04-22  9:20     ` Peter Maydell [this message]
2021-04-22 15:39       ` Richard Henderson
2021-05-02  4:02         ` Brad Smith
2021-05-27 20:32           ` Brad Smith

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='CAFEAcA9TaxkByWscOa2WC=o6fXAxaqAUt30CUsmA24jZ6HEYEA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=brad@comstyle.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 NNTP newsgroup(s).