Hi Richard, > Hmm, OK. I guess it makes things more consistent in that sense > (PIC vs. non-PIC). But on the other side it's making things less > internally consistent for non-PIC, since we don't use the GOT for > anything else there. I guess in principle there's a danger that a > custom *-elf linker script might not bother to set up the .got properly, > on the assumption that it shouldn't be needed.
The GOT is always used in executables (even an empty main function has a non-zero .got and .got.plt section). When you need an indirection, using an existing mechanism is better than doing something special. For example if the weak reference is resolved to a local symbol, the linker could remove the indirection. Cheers, Wilco