The GCC doc says:
some targets may carry a speed or code size penalty on variable references.
But is x86 actually one of them?
On x86_64 I see zero difference in the code generated. On 32-bit, there is a difference in the code generated by the compiler, but after linking, the two look identical.
On 32-bit the compiler generates
movl x@GOT(%eax), %eax
without -fno-common, vs
leal x@GOTOFF(%eax), %eax
but the linker seems to convert the mov into lea.
The GCC doc says:
But is x86 actually one of them?
On x86_64 I see zero difference in the code generated. On 32-bit, there is a difference in the code generated by the compiler, but after linking, the two look identical.
On 32-bit the compiler generates
movl x@GOT(%eax), %eaxwithout -fno-common, vs
leal x@GOTOFF(%eax), %eaxbut the linker seems to convert the mov into lea.