Skip to content
Advertisement

why virtual address of LOAD program header and runtime virtual address shown by gdb is different?

I’ve been trying to understand elf file format and on elf format documentation, VirtAddr of LOAD header should be the virtual address of the loaded segment. But gdb memmap shows segments to be loaded at different virt address.

JavaScript

gdb memmap

JavaScript

Advertisement

Answer

VirtAddr of LOAD header should be the virtual address of the loaded segment.

This is only true for ELF images of type ET_EXEC.

But you have an ELF image of type ET_DYN (probably a position independent executable), and these are relocated at runtime to a different virtual address.

Advertisement