1
votes

ELF files consists of sections based on their contents such as .data,.text, .rodata etc and these sections are grouped into segments that guide how the ELF is mapped/loaded into the memory (Virtual/Physical mappings). These segments are formed by grouping bunch of sections together in the ELF.

example:

 Section to Segment mapping:
  Segment Sections...
   00     .hash .dynsym .dynstr .rela.dyn .rela.plt 
   01     .plt .text 
   02     .rodata 
   03     .data.rel.ro .dynamic .got .got.plt .data .version_section .bss 
   04     .dynamic 

I want to know how this grouping of sections is determined. Is is possible to control this grouping into segments. For example I would like to have .version_section as a separate segment altogether. Any idea how I would I go about this?

If linker script commands can be used then it would be great to know which ones. Thanks in advance. :)

1

1 Answers

1
votes

Assuming you are talking about gcc, it looks like you can use the --script option to provide ld with detailed instructions using their Command Script language