https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119386
--- Comment #5 from Ard Biesheuvel <ardb at kernel dot org> --- (In reply to Franz Sirl from comment #4) > > Note that the GCC man page is pretty clear about this: > > > > -mdirect-extern-access > > -mno-direct-extern-access > > > > Do not use or use GOT to access external symbols. The default is > > -mno-direct-extern-access: GOT is used for external symbols with default > > visibility, but not used for other external symbols. > > > > With -mdirect-extern-access, GOT is not used and all external > > symbols are PC-relatively addressed. It is only suitable for > > environments where no dynamic link is performed, like firmwares, OS > > kernels, executables linked with -static or -static-pie. > > -mdirect-extern-access is not compatible with -fPIC or -fpic. > > This is a quote from the LoongArch option, the x86 option reads: > Oops, sorry about that. > '-mno-direct-extern-access' > Without '-fpic' nor '-fPIC', always use the GOT pointer to access > external symbols. With '-fpic' or '-fPIC', treat access to > protected symbols as local symbols. The default is > '-mdirect-extern-access'. > > *Warning:* shared libraries compiled with > '-mno-direct-extern-access' and executable compiled with > '-mdirect-extern-access' may not be binary compatible if protected > symbols are used in shared libraries and executable. OK, so strangely enough, I am failing to reproduce this locally. My GCC 14 emits the call with a R_X86_64_PLT32 relocation rather than a R_X86_64_PC32, and this avoids the issue. How did you build this compiler? Is this reproducible with the distro version?