Skip to content

Add dead-strip / split-sections for iOS builds #200

@jappeace-sloth

Description

@jappeace-sloth

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

  1. Add -dead_strip to the iOS linker invocation (safe, works at per-object granularity)
  2. Optionally test -split-sections on Darwin — may produce linker errors or miscompilations
  3. Could gate -split-sections behind a platform check (Linux/Android only) until GHC stabilizes macOS support

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions