当前位置: 技术问答>linux和unix
请教:linux 2.6内核汇编中的.size起什么作用?
来源: 互联网 发布时间:2016-09-14
本文导语: linux 2.6内核汇编中经常看到.size,比如在arch/arm/mm/proc-v6.S中: .type cpu_arch_name, #object cpu_arch_name: .asciz "armv6" .size cpu_arch_name, . - cpu_arch_name .type cpu_elf_name, #object cpu_elf_name: .asciz "v6" .size cpu_elf_name, . - cpu_elf_name...
linux 2.6内核汇编中经常看到.size,比如在arch/arm/mm/proc-v6.S中:
.type cpu_arch_name, #object
cpu_arch_name:
.asciz "armv6"
.size cpu_arch_name, . - cpu_arch_name
.type cpu_elf_name, #object
cpu_elf_name:
.asciz "v6"
.size cpu_elf_name, . - cpu_elf_name
在网上查到了如下说明:
“ .size name , expression
This directive sets the size associated with a symbol name. The size in bytes is computed from expression which can make use of label arithmetic. This directive is typically used to set the size of function symbols. ”
但通过分析编译出来的bin文件,发现.size这一行根本就没有什么作用:在"armv6"字符串后面直接放置的"v6"。
盼望大牛指点,先谢谢了。
.type cpu_arch_name, #object
cpu_arch_name:
.asciz "armv6"
.size cpu_arch_name, . - cpu_arch_name
.type cpu_elf_name, #object
cpu_elf_name:
.asciz "v6"
.size cpu_elf_name, . - cpu_elf_name
在网上查到了如下说明:
“ .size name , expression
This directive sets the size associated with a symbol name. The size in bytes is computed from expression which can make use of label arithmetic. This directive is typically used to set the size of function symbols. ”
但通过分析编译出来的bin文件,发现.size这一行根本就没有什么作用:在"armv6"字符串后面直接放置的"v6"。
盼望大牛指点,先谢谢了。
|
我觉得汇编级别,某个符号所占的内存长度也是重要的属性
符号名表示起始地址,再加上长度,才能完整标示一个符号
符号名表示起始地址,再加上长度,才能完整标示一个符号