[LinkerScript.13] SECTION命令


The SECTIONS command tells the linker how to map input sections into output sections, and how to place the output sections in memory.

SECTION命令用于告诉链接器如何去映射输入section到输出section,以及如何把输出section放置到内存中.


The format of the SECTIONS command is:

SECTION命令的格式如下:

     SECTIONS
     {
       sections-command
       sections-command
       ...
     }

Each sections-command may of be one of the following:

每个section-command可能是如下其中一种:

  • an ENTRY command (see Entry command)
  • a symbol assignment (see Assignments)
  • an output section description
  • an overlay description

The ENTRY command and symbol assignments are permitted inside the SECTIONS command for convenience in using the location counter in those commands. This can also make the linker script easier to understand because you can use those commands at meaningful points in the layout of the output file.

为了方便使用在这些命令里的位置计数, ENITRY命令和符号赋值只允许在SECTION命令之内.这样也可以更加容易地理解链接器脚本,因为你是在输出文件的有意义的位置上使用这些命令.


Output section descriptions and overlay descriptions are described below.

输出section描述和叠加描述在下面介绍.


If you do not use a SECTIONS command in your linker script, the linker will place each input section into an identically named output section in the order that the sections are first encountered in the input files. If all input sections are present in the first file, for example, the order of sections in the output file will match the order in the first input file. The first section will be at address zero.

如果在你的链接器脚本中没有使用SECTION命令,那么链接器将按照顺序,把输入文件中先出现的每个输入section放入一个有同样名称的输出section中.  例如, 如果所有输入section都是在第一个文件中的, 那么在输出文件中的section的顺序就是第一个输入文件中的顺序. 第一个section的地址被设置为0.


























你可能感兴趣的:(LinkerScript)