ALIGN in Linker Scripts

后端 未结 3 983
梦如初夏
梦如初夏 2021-02-04 05:12

What does the ALIGN keyword do in linker scripts? I read many tutorials about linker scripts but I cant understand what really ALIGN do. Can any one explain it simply. Thanks!

3条回答
  •  耶瑟儿~
    2021-02-04 05:55

    A typical usage is

    . = ALIGN(8);
    

    This means: insert padding bytes until current location becomes aligned on 8-byte boundary. That is:

    while ((current_location & 7) != 0)
      *current_location++ = padding_value;
    

提交回复
热议问题