3 ms·
With the GNU linker, you would have to go out of your way to link all of a library, like: ld ... --whole-archive libwhatever.a --no-whole-archive Into the 1
by kazinator 2y ago
With the GNU linker, you would have to go out of your way to link all of a library, like:
ld ... --whole-archive libwhatever.a --no-whole-archive
Into the 1990s, it was still a big deal whether a linker could eliminate individual unused functions rather than just remove unused object files. I recall this ability is called function linking.
In GCC they wanted function linking for the libgcc.a functions that provide run-time support, like numeric functions (e.g. division) needed by some generated code to make up for what the machine's instruction set does not provide.
GCC's build process simulated (maybe still does?) function linking for libgcc.a by using the preprocessor to compile the file with these routines multiple times, separating the output into multiple .o files containing just one function.
These days we have a libgcc as a shared library.