DJ: Direct jump
IJ: Indirect jump
PLT: Produce linkage table
Sources
int main (int argc, char *argv[]) { puts ("Hello"); puts ("World"); return 0; } |
x86_64 PLT(DJ + IJ)
main: callq puts@plt puts@plt: jmpq *0x2fe2(%rip) # .got.plt # 1st call: point to 1: # non-1st call: point to puts: 1: pushq $0x0 # symbol index jmpq _dl_runtime_resolve puts: |
1st call:
main -> puts@plt -> _dl_runtime_resolve -> puts
non-1st call:
main -> puts@plt -> puts
x86_64 PLT(IJ)
main: callq *0x2fe2(%rip) # .got.plt # 1st call: point to puts@plt # non-1st call: point to puts: puts@plt: pushq $0x0 # symbol index jmpq _dl_runtime_resolve puts: |
1st call:
main -> puts@plt -> _dl_runtime_resolve -> puts
non-1st call:
main -> puts
Over!