On Wed, 21 Apr 2021 at 02:15, Brad Smith <b...@comstyle.com> wrote:
>
> Fix building with Clang.
>
> At the moment Clang does not define _CALL_SYSV as GCC does. From
> clang/lib/Basic/Targets/PPC.cpp in getTargetDefines()..
>
>   // FIXME: The following are not yet generated here by Clang, but are
>   //        generated by GCC:
>   //
>   //   _SOFT_FLOAT_
>   //   __RECIP_PRECISION__
>   //   __APPLE_ALTIVEC__
>   //   __RECIP__
>   //   __RECIPF__
>   //   __RSQRTE__
>   //   __RSQRTEF__
>   //   _SOFT_DOUBLE_
>   //   __NO_LWSYNC__
>   //   __CMODEL_MEDIUM__
>   //   __CMODEL_LARGE__
>   //   _CALL_SYSV
>   //   _CALL_DARWIN
>
> This is from the OpenBSD ports tree where we use it to build
> on OpenBSD/powerpc.
>
> Signed-off-by: Brad Smith <b...@comstyle.com>
>
> diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
> index 838ccfa42d..d2611832e5 100644
> --- a/tcg/ppc/tcg-target.c.inc
> +++ b/tcg/ppc/tcg-target.c.inc
> @@ -25,6 +25,11 @@
>  #include "elf.h"
>  #include "../tcg-pool.c.inc"
>
> +/* 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.

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 ?

thanks
-- PMM

Reply via email to