Skip to content

Commit e5c33a1

Browse files
committed
[importc]: Fix math.h on glibc aarch64
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
1 parent 2f6c206 commit e5c33a1

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

runtime/druntime/src/__importc_builtins.di

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,10 @@ else version (LDC)
193193
version (X86) public import ldc.gccbuiltins_x86;
194194
version (X86_64) public import ldc.gccbuiltins_x86;
195195
}
196+
197+
version (CRuntime_Glibc) version (AArch64)
198+
{
199+
// math.h needs these
200+
alias __Float32x4_t = __vector(float[4]);
201+
alias __Float64x2_t = __vector(double[2]);
202+
}

runtime/druntime/src/importc.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,16 @@ typedef unsigned long long __uint64_t;
187187
#define _Float128 long double
188188
#define __float128 long double
189189
#endif
190+
191+
#ifdef __aarch64__
192+
// glibc's math.h needs these types to be defined
193+
typedef struct {} __SVBool_t;
194+
typedef struct {} __SVFloat32_t;
195+
typedef struct {} __SVFloat64_t;
190196
#endif
191197

198+
#endif // __linux__
199+
192200
#if __APPLE__
193201
#undef __SIZEOF_INT128__
194202
#endif

0 commit comments

Comments
 (0)