Note that on x86-64, this works, but is *not* solved like the hacky method that Ian Lance Taylor describes in his blog.
Instead of using an undefined symbol with an actual value in main, x86-64 will create a normal undefined symbol with a 0 value:
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND testFunction
This works well: The relocations in libshared.so is a relative relocation that resolves to the actual address of testFunction (not the PLT stub), and the relocation in main is a R_X86_64_GLOB_DAT relocation that resolves to the address of testFunction in libshared.so, and all just works.
This is less hacky, and I think also the proposed patch from the mailing list solves the problem this way.
Note that on x86-64, this works, but is *not* solved like the hacky method that Ian Lance Taylor describes in his blog.
Instead of using an undefined symbol with an actual value in main, x86-64 will create a normal undefined symbol with a 0 value:
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND testFunction
This works well: The relocations in libshared.so is a relative relocation that resolves to the actual address of testFunction (not the PLT stub), and the relocation in main is a R_X86_64_GLOB_DAT relocation that resolves to the address of testFunction in libshared.so, and all just works.
This is less hacky, and I think also the proposed patch from the mailing list solves the problem this way.