https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88954
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Target Milestone|--- |9.0 --- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to nsz from comment #7) > note that with > > void f_noplt(void) __attribute__((noplt)); > void (*p)(void) = f_noplt; > > the linker may create a PLT for f_noplt and use its address to initialize p > in > case of non-pie linking. > > alternatively the linker may emit a dynamic relocation for p so it is filled > in > by the dynamic linker to the actual address of f_noplt. > > it seems the bfd linker on x86_64 does the latter (if there is otherwise no > PLT), > but e.g. the gold linker does the former. (as far as the sysv abi is > concerned > both behaviours are correct, the linker does not know about the noplt attr.) > > this means that (depending on linker behaviour) a noplt function may get a > PLT in > non-pie executables (so noplt can only avoid lazy binding and jump slot > relocs > reliably in pic code), may be linkers should be fixed so noplt always avoids > PLT > (on x86_64, other targets have other issues with non-pic), but then this has > to > be abi to be reliable. Gold doesn't have the same optimization as bfd linker on x86. This is just one of them.