In the early aughts I was kicking around an idea for minimization of binaries/libraries. The idea was to take a compiled binary plus debug information, and use disassembly to work out which code paths are reachable from a selected set of entry points (say the ones used by your application). Then code paths which are considered "dead" would be zeroed out, preparing a minimized binary.