Key difference in the out of ld -pie and ld without -pie?

Fangrui Song i@maskray.me
Sat Apr 24 05:18:10 GMT 2021


On 2021-04-22, Peng Yu via Binutils wrote:
>Hi,
>
>I am trying to see the key difference between ld -pie and ld without
>it in terms of the a.out output. I tried the following example.

The default image base is non-zero for -no-pie (default; not actually an
option in GNU ld yet but Nick says he will add one).

All relocations referencing a non-preemptible symbol can be resolved,
including absolute GOT-generating relocations (e.g. R_AARCH64_LD64_GOT_LO12_NC),
PC-relative GOT-generating relocations (e.g. R_X86_64_REX_GOTPCRELX).

The GOT entry for a non-preemptible symbol is a constant, if the GOT
entry cannot be optimized out.

Some architectures have different PLT code sequences (i386, ppc32 .glink).
R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX can be further optimized.
ppc64 .branch_lt (long branch addresses) can be optimized.


More information about the Binutils mailing list