PIC, PIE and Sanitizers
mropert.github.io
mropert.github.io
More seriously the use of a offset table is an implementation detail.
On macOS at least dyld directly patches the majority of cross-object calls and accesses through stubs, either converting access to a direct absolute address or a assembly stub that tail calls to the correct place. (Very much a generalization here :) )
So yes if your code is extremely heavily limited by call and load overhead from accessing another library you’ll see a real perf impact. But at that point you should be asking why you’re calling such a lightweight function so much that the call overhead itself is a problem.
-Bsymbolic-functionsAll this became relevant to me while integrating some Sanitizer CMake modules in my projects: https://github.com/arsenm/sanitizers-cmake where I opened an issue to talk about the subject (https://github.com/arsenm/sanitizers-cmake/issues/13).
Turns out Qt seems to depend on some obscure / not very well documented behavior of PIC instead of PIE, so their builds would break if using '-pie', or at least that's what I understood. In summary I'm amused how such a seemingly simple operation is getting so much time and complications to implement properly.
I'm happy to see more conversation about this topic, because as of now it is still somewhat difficult to grasp and use correctly.