Page MenuHomeSerpent OS

Boulder: GC options
Open, HighPublic


Using lld allows for extra options for garbage collection during linking. --gc-sections does a pretty good job, but --icf=safe adds some extra GC. Note, that these work even with -flto enabled and are further improved with -fdata-sections and -ffunction-sections


  • Validate that the order doesn't matter between --gc-sections and --icf=safe
  • Test some variations for size
    • -flto
    • -flto --gc-sections
    • -flto --icf=safe
    • -flto --icf=safe --gc-sections
    • -fdata-sections -ffunction-sections --gc-sections
    • -fdata-sections -ffunction-sections --icf=safe
    • -fdata-sections -ffunction-sections --icf=safe --gc-sections
  • Determine whether to enable --icf=safe by default
  • Test --icf=all as well to indicate how much it could improve in the near future
  • Ensure GNU hash style (is the only hash style)
  • Review readelf -a to check for anything unnecessary
  • Test debug builds to impact on file size after stripping
  • Benchmark build times when compressing debug files at link time vs end of build
  • Build full ABI graph before hand to validate that it doesn't strip symbols

Event Timeline

sunnyflunk created this task.

Wl,--print-gc-sections,--print-icf-sections will help understand what's going on