the question about PT_DYNAMIC's p_offset value in elf file for mips platform

Nick Clifton nickc@redhat.com
Tue Oct 26 08:24:00 GMT 2004


Hi Eagle,

 > I do not know why PT_DYNAMIC's p_offset is 0x0000ac. I think the
 > correct value should be 0x1008.

The PT_DYNAMIC segment includes more than just the .dynamic section.  It 
also includes sections like .hash, .dynsym etc.  Hence the segment 
starts at the lowest offset of all of these sections, which in this case 
is the .hash section.

If you have a look at the section to segment mapping output from readelf:

>       Section to Segment mapping:
>        Segment Sections...
>         00     .hash .dynsym .dynstr .text .MIPS.stubs .rel.dyn
>         01     .data .dynamic .got .bss
>         02     .reginfo .hash .dynsym .dynstr .text .MIPS.stubs .data
> .dynamic .debug_aranges .debug_pubnames .debug_info .debug_abbrev
> .debug_line .debug_frame .debug_str .pdr .rel.dyn .compact_rel .shstrtab
> .symtab


You can see the relationship between segments and sections.

Cheers
   Nick



More information about the Binutils mailing list