Linker Scripts SECTIONS 部分的一个疑问

在M4 里面Linker Scripts 看到有如下部分描述

SECTIONS
{
     .AppinInfo :
    {
        KEEP(*(.AppinInfo))
    }>FLASH = 0xff

}

一直没搞明白 这个= 0xff 是什么意思,相关中文网是找遍了也没这部分解释,于是只能找老外的网站了,尤其是要找到官方资料。

https://sourceware.org/binutils/docs/ld/Output-Section-Fill.html#Output-Section-Fill

3.6.8.8 Output Section Fill

You can set the fill pattern for an entire section by using ‘=fillexp’. fillexp is an expression (see Expressions). Any otherwise unspecified regions of memory within the output section (for example, gaps left due to the required alignment of input sections) will be filled with the value, repeated as necessary. If the fill expression is a simple hex number, ie. a string of hex digit starting with ‘0x’ and without a trailing ‘k’ or ‘M’, then an arbitrarily long sequence of hex digits can be used to specify the fill pattern; Leading zeros become part of the pattern too. For all other cases, including extra parentheses or a unary +, the fill pattern is the four least significant bytes of the value of the expression. In all cases, the number is big-endian.

You can also change the fill value with a FILL command in the output section commands; (see Output Section Data).

Here is a simple example:

SECTIONS { .text : { *(.text) } =0x90909090 }

原来是用来填充的!

We showed above that the full description of an output section looked like this:

section [address] [(type)] :
  [AT(lma)]
  [ALIGN(section_align) | ALIGN_WITH_INPUT]
  [SUBALIGN(subsection_align)]
  [constraint]
  {
    output-section-command
    output-section-command
    …
  } [>region] [AT>lma_region] [:phdr :phdr …] [=fillexp]

具体详情可以看gcc ld 中文手册,里面很详细介绍了Linker Scripts 的语法,看来还是要找对资料才行。

你可能感兴趣的:(linux)