All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>, Brad Smith <brad@comstyle.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH] tcg/ppc: Fix building with Clang
Date: Wed, 21 Apr 2021 22:18:22 -0700	[thread overview]
Message-ID: <1ebc5a66-2763-1379-24e0-774739f2edbe@linaro.org> (raw)
In-Reply-To: <CAFEAcA995L--csz+fX4MqkSPTPxQ7Nx=q-Lh70bi_zQGoj54mw@mail.gmail.com>

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


r~


  reply	other threads:[~2021-04-22  5:20 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 [this message]
2021-04-22  9:20     ` Peter Maydell
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=1ebc5a66-2763-1379-24e0-774739f2edbe@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=brad@comstyle.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.