qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tcg/ppc: Fix building with Clang


From: Peter Maydell
Subject: Re: [PATCH] tcg/ppc: Fix building with Clang
Date: Thu, 22 Apr 2021 10:20:39 +0100

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 via email to

[Prev in Thread] Current Thread [Next in Thread]