How to get the GOT address from a PLT stub using GDB
20 days ago
- #dynamic-linking
- #got
- #gdb
- PLT stubs act as trampolines for dynamically linked functions like `puts`, initially jumping to a GOT slot.
- The GOT slot initially points back to the PLT stub's second instruction, which then calls the dynamic linker to resolve the real function address.
- After the first call, the dynamic linker updates the GOT slot with the actual address of the function (e.g., `puts` in `libc.so`).
- Subsequent calls to the function jump directly to the resolved address in the GOT, bypassing the dynamic linker.
- Using `gdb`, you can observe this behavior by examining the GOT slot before and after the first call to `puts`.