连接文件

The SECTIONS command tells the linker how to map input sections into output sections, and how to place the output sections in memory. The format of the SECTIONS command is:
SECTIONS
{
    sections-command
    sections-command
    ...
}
Each sections-command may of be one of the following:
an ENTRY command
a symbol assignment 
an output section description
an overlay description
 
The full description of an output section looks like this:
section [address] [(type)] : [AT(lma)]
{
     output-section-command
     output-section-command
      ...
} [>region] [AT>lma_region] [:phdr :phdr ...] [=fillexp]
Most output sections do not use most of the optional section attributes.

 

You use output sections to tell the linker how to lay out your program in memory. You use input section descriptions to tell the linker how to map the input files into your memory layout.
输入段告诉连接器在内存中如何布置程序,而输入段描述告诉连接器如何将输入文件映射到内存中
 
The MEMORY command describes the location and size of blocks of memory in the target. You can use it to describe which memory regions may be used by the linker, and which memory regions it must avoid.

 

Once you defifine a memory region, you can direct the linker to place specifific output sections  into that memory region by using the ‘ > region’ output section attribute. For example, if you have a memory region named ‘ mem ’, you would use ‘>mem’ in the output section defifinition. If no address was specifified for the output section, the linker will set the address to the next available address within the memory region. If the combined output sections directed to a memory region are too large for the region, the linker will issue an error message.

你可能感兴趣的:(嵌入式系统)