Hasty Briefsbeta

Bilingual

Linking Smaller Haskell Binaries

2 days ago
  • #Haskell
  • #Linker
  • #Binary Optimization
  • Haskell binaries can be large, especially for projects with many dependencies.
  • Two strategies to reduce binary size: `-split-sections` and `--gc-sections`.
  • Using `-split-sections` and `--gc-sections` reduces binary size by 27%.
  • Identical Code Folding (ICF) with `lld` further reduces size by 23%.
  • ICF identifies and combines functionally-equivalent sections in the binary.
  • Debugging with `objdump` shows folded sections but mapping to source is unclear.
  • Interaction with `-fdistinct-constructor-tables` affects debugging info.
  • Potential to speed up compilation by caching duplicate sections.
  • Tools like `bloaty` and `kcov` were tried but didn't work effectively.