How Section to Segment mapping is derived from ELF file?

Nick Clifton nickc@redhat.com
Wed Apr 21 15:59:52 GMT 2021


Hi Peng,

> How is this relation figured out by readelf? Could anyone help explain
> the details?

Readelf uses the macro ELF_SECTION_IN_SEGMENT_STRICT to determine if a 
section maps to a specific segment.  This macro, defined in 
include/elf/internal.h is quite complex, but essentially it boils to to 
matching section ranges (start address..start address + size) to segment 
ranges.  If a section's range is contained within a segment's range, 
then it is considered to be mapped to that segment.

Cheers
   Nick




More information about the Binutils mailing list