Sections Segment

Use the sections segment to define the contents of memory sections, and to define any global symbols that you want to use in your output file. The following listing shows the format of a sections segment.

Listing: Example Sections Segment

SECTIONS {

   .section_name : #The section name, for your reference,

   {               # must begin with a period.

      filename.c  (.text) #Put .text section from filename.c,

      filename2.c (.text) #then put .text section from filename2.c,

      filename.c  (.data) #then put .data section from filename.c,

      filename2.c (.data) #then put .data section from filename2.c,

      filename.c  (.bss)  #then put .bss section from filename.c,

      filename2.c (.bss)  #then put .bss section from filename2.c.

      . = ALIGN (0x10);   #Align next section on 16-byte boundary.

   } > segment_1          #Map these contents to segment_1.

   .next_section_name:

   {

      more content descriptions

   } > segment_x          #End of .next_section_name definition

}                         #End of sections segment

For more information about the sections segment, refer to the topic "SECTIONS" on page 153 of this manual.