https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115944
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- With -fPIC GCC assumes that a different definition of the functions might be interposed later, so it emits a call (and assumes you're going to link to another object which provides a definition without undefined behaviour). If you use -fPIC -fno-semantic-interposition then you say that won't happen, so GCC goes back to assuming you never call the function. GCC seems to be working as designed.