Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 2
    Whenever a shared lib is loaded, the loader changes some addresses in the code depending on where the object was loaded to. I think this is not correct if compiled with -fpic and the reason why -fpic exists i.e. for performance reasons or because you have a loader that's not able to relocate or because you need multiple copies in different locations or for many more reasons. Commented Apr 15, 2020 at 14:16
  • 13
    Why not always use -fpic? Commented Apr 21, 2020 at 6:22
  • 15
    @Jay - because it will required one more calculation (the function address) for each function call. So performance-wise, if not needed it is better not to use it. Commented Apr 21, 2020 at 6:41

lang-cpp