TLDR Dev · OPINIONS & ADVICE

SHRINKING WHILE LINKING

tweag.io12 min read

Summary from the TLDR Dev newsletter

This post discusses two ways to significantly reduce the size of a static library. One uses classic tools like ld and objcopy, while the other uses LLVM-specific tools. They both produce similar-sized outputs, but there are some trade-offs. The 'classic' bintools approach works with both GNU bintools and LLVM bintools, and it's significantly faster than the LLVM tools, which need to recompile everything from the intermediate representation to machine code. However, the LLVM approach works on macOS, Linux, Windows, and probably others, making it more versatile.