I'm reading an textbook which says:
The motivation for lazy binding is that a typical application program will call only a handful of the hundreds or thousands of functions exported by a shared library such as libc.so. By deferring the resolution of a function’s address until it is actually called, the dynamic linker can avoid hundreds or thousands of unnecessary relocations at load time.
I kind of get the idea, but still confused. Let's say a program only call 10 functions of a shared library which has 100 fucntions inside. without lazy binding, the linker will only need to do 10 relocations for the functions the program use, so with lazy binding, how does dynamic linker can avoid hundreds or thousands(100 functions in this scenario) of unnecessary relocations? it is like you try to solve a problem which doesn't actually exist?
From what I can see about the lazy binding, there is no relocation needed at the load time, so you do save the time of doing 10 relocation,that's the only benefit I can see, is my understanding correct? but the author seems to indicate without lazy binding, the linker needs to do 100 relocations?