3 ms·
In C and C++ you can conservatively eliminate unused code for statically linked libraries using --gc-sections and -fdata-sections. Go uses the Plan9 compiler a
by adrusi 11y ago
In C and C++ you can conservatively eliminate unused code for statically linked libraries using --gc-sections and -fdata-sections.
Go uses the Plan9 compiler architecture, which means that its linker knows more about the code and is responsible for more optimizations than its Unix equivalent, so it quite effectively eliminates dead code.
Of course, libraries are often highly coupled within themselves, so not much code can be eliminated, and then they might pull in additional dependencies, etc., etc.
- cbd1984 11y agoInteresting. I didn't realize there had been any substantive new work done on linkers in decades.