How Section to Segment mapping is derived from ELF file?

Nick Clifton nickc@redhat.com
Wed Apr 21 14:40:35 GMT 2021


Hi Peng,

> I see there is a mapping between section to segment. It is not quite
> clear where this mapping is specified in the ELF spec. Could anybody
> explain how this is derived from the ELF file by readelf?

There is no official definition of this mapping in the ELF 
specification.  It is just a (hopefully) useful addition to readelf's 
output, allowing readers to see what relationship - if any - exists 
between sections and segments.

In theory segments could be completely unrelated to sections.  But in 
practice the linker will arrange that sections with similar 
characteristics will be mapped together and assigned to a segment that 
also matches those characteristics.

Cheers
   Nick



More information about the Binutils mailing list