From 91a956823ef690eb50ab5ca4a2c4ea3316c9ed37 Mon Sep 17 00:00:00 2001 From: Christian Jullien Date: Wed, 7 Jul 2021 09:50:20 +0200 Subject: [PATCH] [macOS] Add VT_LDOUBLE special case for Rosetta to handle --cpu=x86_64. --- tccgen.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tccgen.c b/tccgen.c index c36032ab..833b7043 100644 --- a/tccgen.c +++ b/tccgen.c @@ -8093,6 +8093,11 @@ static void init_putv(init_params *p, CType *type, unsigned long c) else if (sizeof(double) == LDOUBLE_SIZE) memcpy(ptr, &vtop->c.ld, LDOUBLE_SIZE); #ifndef TCC_CROSS_TEST +#if defined(TCC_TARGET_MACHO) && defined(TCC_TARGET_X86_64) + /* Special case for Rosetta to handle --cpu=x86_64 on macOS */ + else if (sizeof(double) == sizeof(long double)) + memcpy(ptr, &vtop->c.ld, sizeof(double)); +#endif else tcc_error("can't cross compile long double constants"); #endif