On Tue, 7 Mar 2023, Xi Ruoyao via Gcc-help wrote: > This won't work for a function pointer either: the value of the > function pointer must be the address of foo itself, not foo@plt. Or the > result of &foo in the shared library and the main executable will be > different, violating the C or C++ standard. Then we must use > R_X86_64_JUMP_SLOT which is handled by the dynamic linker. (you probably meant GLOB_DAT in the last statement) This paragraph is inaccurate: traditional non-PIC, non-PIE codegen uses direct symbol references. So, when you have a direct reference to foo in non-PIC main executable, the reference is resolved to its PLT slot, and the address of that PLT slot becomes the canonical address of 'foo' for the whole program. When the main executable is PIE, it may or may not have a PLT slot for 'foo', and if it doesn't, the canonical address of 'foo' is its actual implementation. Alexander