Why can a section be mapped to multiple segments?

Fangrui Song i@maskray.me
Wed May 5 20:19:17 GMT 2021


On 2021-05-05, Alan Modra via Binutils wrote:
>On Tue, May 04, 2021 at 07:07:26PM -0500, Peng Yu via Binutils wrote:
>> Hi,
>>
>> I see .tdata is mapped to multiple segments. Why a section can be
>> mapped to multiple segments? Isn't that it is sufficient to map a
>> section to a segment once so that when the program run, the program
>> can access the data in the section? Thanks.
>
>It is sufficient to map a section to one PT_LOAD header in order for
>that section to be loaded into memory, but there are other program
>header types with meaning differing from "load this segment".
>
>You can find the meaning of other header types by doing web searches,
>looking at the source, or finding the mailing list posts where those
>header type were first introduced into binutils and glibc.

The PT_TLS program header is contained in a PT_LOAD program header. If
PT_GNU_RELRO is used, PT_TLS is contained in a PT_GNU_RELRO and the
PT_GNU_RELRO is contained in a PT_LOAD.

PT_LOAD causes the TLS initialization image (PT_TLS) to be mapped.


More information about the Binutils mailing list