Agner Fog <agner@xxxxxxxxx> writes: > Interestingly, it all works in 32 bit mode. I can compile without > -fpic and make an absolute reference to a global variable with no GOT > entry and no PLT in a shared object and I get no warnings or > errors. It just works. Also, there is no exception handler section > even though I did not turn off exceptions. > > Why is 64 bit mode so different? There are specific reasons for each specific difference. > Is there no way to avoid 32 bit absolute addresses in 64 bit mode > other than -fpic which has the undesired effect of using GOT and PLT > entries? -mcmodel=large. > This is weird: > -fpic doesn't make position-independent code as the name implies - it > makes code that fits into a shared object. My test code compiled with > -fpic or -fPIC still has absolute references in virtual tables and in > the exception handler section in both 32 and 64 bit mode. I think the documentation is correct. > -Bsymbolic doesn't seem to do anything. At least it doesn't prevent > GOT entries -Bsymbolic is a linker option, and it does do something at the linker level. However, the linker is unable to eliminate a GOT once the compiler has created one. Ian