Problem
PR #196 adds -split-sections + --gc-sections for Android .so builds, reducing binary size by ~40-60%. The iOS builds don't have equivalent size reduction.
Context
- On iOS/macOS (Mach-O), the equivalent of
--gc-sections is -dead_strip on the Apple linker (ld64)
- GHC's
-split-sections may be buggy on macOS/Darwin targets — a GHC maintainer has indicated this
-dead_strip on the linker side should be safe independently of -split-sections
Possible approach
- Add
-dead_strip to the iOS linker invocation (safe, works at per-object granularity)
- Optionally test
-split-sections on Darwin — may produce linker errors or miscompilations
- Could gate
-split-sections behind a platform check (Linux/Android only) until GHC stabilizes macOS support
References
Problem
PR #196 adds
-split-sections+--gc-sectionsfor Android.sobuilds, reducing binary size by ~40-60%. The iOS builds don't have equivalent size reduction.Context
--gc-sectionsis-dead_stripon the Apple linker (ld64)-split-sectionsmay be buggy on macOS/Darwin targets — a GHC maintainer has indicated this-dead_stripon the linker side should be safe independently of-split-sectionsPossible approach
-dead_stripto the iOS linker invocation (safe, works at per-object granularity)-split-sectionson Darwin — may produce linker errors or miscompilations-split-sectionsbehind a platform check (Linux/Android only) until GHC stabilizes macOS supportReferences