Experiment and learn how compilers, linkers and C runtime work cooperatively
A static-pie linked executable is a fully statically linked executable which
is also a PIE. Since it is fully statically linked, it does not depend
on any dynamically loaded libraries. However, since it is a PIE, the
ELF file will have both the .dynamic
and the .rel[a].dyn
sections.
The reason for requiring dynamic relocations (those in .rel[a].dyn
) in a
static-pie binary are explained in
this example.
A statically linked PIE binary differs from a dynamically linked PIE binary in the following ways:
PT_INTERP
segment in a
static-pie binary.DT_NEEDED
entries as a static-pie binary
does not need any dynamically loaded libraries.