2 ms·
It's not for nothing. Function calls into shared libraries are pretty disgusting.
by kazinator 2y ago
It's not for nothing. Function calls into shared libraries are pretty disgusting.
- worthless-trash 2y agoYou'll need to elaborate that, because I have read the assembly for a function call in shared libraries and wasn't too disturbed by it... what do you mean ?
- ahartmetz 2y agoThe first call is through a function pointer to a symbol resolution function, in any subsequent call the function pointer has been patched to directly call the desired function. Seems pretty good to me.
- kazinator 2y agoIt's pretty gross. The shared lib call keeps going through a stub in the procedure link table; only the stub has improved after the first call so that it doesn't have to keep fetching the address of the function via the global offset table. The details are architecture specific, but it has overhead pretty much everywhere. On top of that, a register is dedicated to pointing to the global offset table. It has to be saved reassigned and restored as the control flow path takes trips through multiple shared libraries.