From b329daa22a11efb4fee2be05880a984ba1bb6b52 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Fri, 16 Oct 2026 23:54:59 +0900 Subject: [PATCH] fix(nix): register ARM64 GNU iconv interpreter symbols --- scripts/nix/android-iserv-arm64-api.patch | 39 +++++++++++++++++------ 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/scripts/nix/android-iserv-arm64-api.patch b/scripts/nix/android-iserv-arm64-api.patch index de61ad50f6..d7431a36ac 100644 --- a/scripts/nix/android-iserv-arm64-api.patch +++ b/scripts/nix/android-iserv-arm64-api.patch @@ -1,14 +1,35 @@ --- a/cbits/symbols.aarch64-android.c +++ b/cbits/symbols.aarch64-android.c -@@ -171,8 +171,11 @@ - SYM(htonl), - SYM(ntohl), - // sys/random.h +@@ -10,0 +11,4 @@ ++#include ++#ifdef _LIBICONV_VERSION ++#include ++#endif +@@ -117,2 +121,2 @@ +-// bionic has had nl_langinfo since API 26 and iconv since API 28; the NDK we +-// build against targets API 35. ++// Bionic provides nl_langinfo from API 26 and iconv from API 28. The ++// selected iconv.h describes either Bionic or the declared GNU dependency. +@@ -120,3 +123,0 @@ +-extern void iconv_open(void); +-extern void iconv(void); +-extern void iconv_close(void); +@@ -173,0 +175,2 @@ + // These public Bionic APIs are declared only from API level 28. +#if __ANDROID_API__ >= 28 - SYM(getentropy), - SYM(getrandom), +@@ -175,0 +179 @@ ++#endif +@@ -497,0 +502,3 @@ ++#ifdef _LIBICONV_VERSION ++ // Keep plain lookup names while the header maps their real addresses ++ // to GNU definitions, and expose the GNU names used by ghc-internal. +@@ -500,0 +508,9 @@ ++ SYM(libiconv_open), ++ SYM(libiconv), ++ SYM(libiconv_close), ++ SYM(locale_charset), ++#elif __ANDROID_API__ >= 28 ++ SYM(iconv_open), ++ SYM(iconv), ++ SYM(iconv_close), +#endif - // sys/auxv.h - SYM(getauxval), - // sys/mman.h