This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What is the significance of two dot in a section name; ie: .data.init_task


Hi William,

> What is the significance of two dot in a section name; ie: .data.init_task ?

Technically nothing.  In the ELF standard sections can have as
many dots in their names as they want, and the dots have no 
special significance.

In practice however a second dot is often used to indicate that 
the section is intended to become part of the section whose name
forms the first part of the string.  So .data.init_task is 
probably a section containing data and it is likely that it will 
be moved into the .data section when the final binary image is 
created.

The reason for creating sections like this is that it allows
the linker to locate and discard sections that are not needed,
thus reducing the size of the final binary.  So for example,
during the link process if the linker discovers that nothing
references any of the data in .data.init_task then it can
discard the section entirely.

Sections like this are often created via the -fdata-sections 
and -ffunction-sections command line options, although there
are other ways of creating them too.

How the linker merges sections together is usually controlled 
by a linker script, (although for the gold linker this is not
true).  The script tells the linker which sections to combine
together to make a single output section, and it can also do
things like tell the linker to sort the section names before
merging them, or discard some sections but keep others.  Have
a read of the linker documentation if you are interested in
learning more about this.

Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]