I've done a bunch of reading on dynamic linker relocations and position independent code including procedure linkage tables and global offset tables. I don't understand why a statically linked executable needs a PLT and GOT. I compiled a hello world program on my ubuntu x86_64 machine and when I dump the section headers with readelf -S
it shows PLT and GOT sections.
I also created a shared library with a simple increment function that I compiled with gcc -shared
without -fpic
and I also see PLT and GOT sections. I didn't expect this either.