From b0938293019030c57cb8fb9a29da0c5e963d34ca Mon Sep 17 00:00:00 2001 From: eakmyr <109408568+eakmyr@users.noreply.github.com> Date: Thu, 26 Mar 2026 00:03:06 +0500 Subject: [PATCH 1/5] Android: Add ImportC definitions --- runtime/druntime/src/importc.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/runtime/druntime/src/importc.h b/runtime/druntime/src/importc.h index 07a8c358ba..2348267243 100644 --- a/runtime/druntime/src/importc.h +++ b/runtime/druntime/src/importc.h @@ -201,3 +201,19 @@ typedef struct {} __SVFloat64_t; #if __APPLE__ #undef __SIZEOF_INT128__ #endif + +#if __ANDROID__ +#undef __SIZEOF_INT128__ +#define __GNUC_VA_LIST +#define _VA_LIST +#define __builtin_va_list va_list +#define __gnuc_va_list va_list +#define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD +#define __alignof__(x) sizeof(x) +#define __builtin_memmove(a,b,c) memmove(a,b,c) +#define __builtin_memset(a,b,c) memset(a,b,c) +#define __builtin_ffs(x) ffs(x) +#define __builtin_ffsl(x) ffsl(x) +#define __builtin_ffsll(x) ffsll(x) +#define __sync_synchronize() +#endif From c5016dfe53564f8572fafde20742a933b84b3cb6 Mon Sep 17 00:00:00 2001 From: eakmyr <109408568+eakmyr@users.noreply.github.com> Date: Thu, 26 Mar 2026 02:44:24 +0500 Subject: [PATCH 2/5] ImportC: sizeof to _Alignof --- runtime/druntime/src/importc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/druntime/src/importc.h b/runtime/druntime/src/importc.h index 2348267243..5b6e9080ff 100644 --- a/runtime/druntime/src/importc.h +++ b/runtime/druntime/src/importc.h @@ -209,7 +209,7 @@ typedef struct {} __SVFloat64_t; #define __builtin_va_list va_list #define __gnuc_va_list va_list #define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD -#define __alignof__(x) sizeof(x) +#define __alignof__(x) _Alignof(x) #define __builtin_memmove(a,b,c) memmove(a,b,c) #define __builtin_memset(a,b,c) memset(a,b,c) #define __builtin_ffs(x) ffs(x) From 98453849cd43bcc9ac3ea94090f24e9892da9647 Mon Sep 17 00:00:00 2001 From: eakmyr <109408568+eakmyr@users.noreply.github.com> Date: Fri, 27 Mar 2026 00:21:33 +0500 Subject: [PATCH 3/5] Remove obsolete builtins --- runtime/druntime/src/importc.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/runtime/druntime/src/importc.h b/runtime/druntime/src/importc.h index 5b6e9080ff..d1f746d0da 100644 --- a/runtime/druntime/src/importc.h +++ b/runtime/druntime/src/importc.h @@ -209,11 +209,6 @@ typedef struct {} __SVFloat64_t; #define __builtin_va_list va_list #define __gnuc_va_list va_list #define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD -#define __alignof__(x) _Alignof(x) -#define __builtin_memmove(a,b,c) memmove(a,b,c) -#define __builtin_memset(a,b,c) memset(a,b,c) -#define __builtin_ffs(x) ffs(x) -#define __builtin_ffsl(x) ffsl(x) -#define __builtin_ffsll(x) ffsll(x) +#define __alignof__ _Alignof #define __sync_synchronize() #endif From 93689303b2336f18579f0497bc645d4f5cce9806 Mon Sep 17 00:00:00 2001 From: eakmyr <109408568+eakmyr@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:49:07 +0500 Subject: [PATCH 4/5] Add comment --- runtime/druntime/src/importc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/druntime/src/importc.h b/runtime/druntime/src/importc.h index d1f746d0da..d67801f6fe 100644 --- a/runtime/druntime/src/importc.h +++ b/runtime/druntime/src/importc.h @@ -208,7 +208,11 @@ typedef struct {} __SVFloat64_t; #define _VA_LIST #define __builtin_va_list va_list #define __gnuc_va_list va_list + +// This macro resolves the ambiguity between Bionic and library ioctl. +// https://android.googlesource.com/platform/bionic/+/master/libc/include/bits/ioctl.h #define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD -#define __alignof__ _Alignof + +#define __alignof__(x) _Alignof(x) #define __sync_synchronize() #endif From be7a0a3058821e6f2a4861e0ddeec3d2a0b96813 Mon Sep 17 00:00:00 2001 From: eakmyr <109408568+eakmyr@users.noreply.github.com> Date: Fri, 27 Mar 2026 17:18:54 +0500 Subject: [PATCH 5/5] Remove __alignof__ from Android --- runtime/druntime/src/importc.h | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/druntime/src/importc.h b/runtime/druntime/src/importc.h index d67801f6fe..c4204f307e 100644 --- a/runtime/druntime/src/importc.h +++ b/runtime/druntime/src/importc.h @@ -213,6 +213,5 @@ typedef struct {} __SVFloat64_t; // https://android.googlesource.com/platform/bionic/+/master/libc/include/bits/ioctl.h #define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD -#define __alignof__(x) _Alignof(x) #define __sync_synchronize() #endif