I'm a bit curious about the internal of ELF
file. And I have this question:
Why we need to compile a shared library (.so)
with the flag -fPIC
?
While theoretically, we can dynamically link an executable with a statically linked elf
file.
This is because the GOT
and PLT
table in the executable need to be updated while the dynamically link executable can be left unchanged.