链接脚本中的ALIGN [英] ALIGN in Linker Scripts

查看:410
本文介绍了链接脚本中的ALIGN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ALIGN关键字在链接描述文件中起什么作用?我阅读了许多有关链接描述文件的教程,但我无法理解ALIGN的实际作用.任何人都可以简单地解释一下.谢谢!

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!

推荐答案

典型用法是

. = ALIGN(8);

这意味着:插入填充字节,直到当前位置在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;

这篇关于链接脚本中的ALIGN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆