Files
simplex-chat/scripts/nix/android-iserv-gnu-iconv.patch
T
Moritz Angermann 748becda3e Enable ARM32 Android Template Haskell on emulated Linux builders
Scope the scheduling opt-out to the patched QEMU versions, patch the interpreter source before planning, and expose the real static Bionic and GNU iconv symbols. Use the RTS package dependency for Android libffi.

The production interpreter reaches Haskell main on Rosetta and native ARM64 QEMU. Normal target TH, the ARM32 shared export, a C caller returning 42, and upstream annotations pass. Profiling execution is not yet validated.
2026-10-16 13:22:52 +09:00

31 lines
1.1 KiB
Diff

--- a/cbits/symbols.armv7a-android.c
+++ b/cbits/symbols.armv7a-android.c
@@ -5,6 +5,14 @@
#include <stdlib.h>
#include <math.h>
#include <errno.h>
+
+// Match GNU libiconv public prototypes without importing system headers
+// that conflict with the legacy untyped declarations below. iconv_t is void*.
+extern void *libiconv_open(const char *tocode, const char *fromcode);
+extern size_t libiconv(void *cd, char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+extern int libiconv_close(void *cd);
+extern const char *locale_charset(void);
extern void __aeabi_idiv(void);
extern void __aeabi_idivmod(void);
@@ -394,6 +402,12 @@
RtsSymbolVal my_iserv_syms[] = {
// { "__sync_val_compare_and_swap_1", (void*)(&___sync_val_compare_and_swap_1), STRENGTH_NORMAL, 1 },
+ // API 26 uses GNU libiconv. Static Bionic dlsym cannot expose these
+ // definitions to loaded Haskell objects; register their real addresses.
+ SYM(libiconv_open),
+ SYM(libiconv),
+ SYM(libiconv_close),
+ SYM(locale_charset),
SYM(strlen),
SYM(__aeabi_idiv),
SYM(__aeabi_idivmod),