开发者

what does =0 at the end of section definition in ld script means?

开发者 https://www.devze.com 2023-02-03 20:27 出处:网络
I just saw a section 开发者_开发技巧definition with =0 at the end i.e .init : { KEEP (*(.init))

I just saw a section 开发者_开发技巧definition with =0 at the end i.e

.init : 
  { 
    KEEP (*(.init))
  } =0

What does that =0 at the end means and what is its significance?


I just found out that =0 at the end of the section definition specifies the fill expression i.e any unused memory within this section will be filled with the value 0, repeated as necessary. An example of such unused memory is gaps left due to alignment requirements of input sections. This initialization doesn't have to be 0, we can use any number or valid LD expression to fill the unused memory.

0

精彩评论

暂无评论...
验证码 换一张
取 消