首页 > 解决方案 > 这里的 .size 指令有什么作用吗?

问题描述

我目前正在尝试使用 LLVM 3.7.1 在 x86-64 主机上为 powerpc64le 目标交叉编译 musl 1.1.18。它无法在下面显示的文件/代码上编译error: unexpected token in '.end' directive那不是我的问题。

src/internal/powerpc64/syscall.s

    .global __syscall
    .hidden __syscall
    .type   __syscall,@function
__syscall:
    mr      0, 3                  # Save the system call number
    mr      3, 4                  # Shift the arguments: arg1
    mr      4, 5                  # arg2
    mr      5, 6                  # arg3
    mr      6, 7                  # arg4
    mr      7, 8                  # arg5
    mr      8, 9                  # arg6
    sc
    bnslr+       # return if not summary overflow
    neg     3, 3 # otherwise error: return negated value.
    blr
    .end    __syscall
    .size   __syscall, .-__syscall

我的问题是:.size这里的指令有什么作用吗?根据 gas 文档,该.end指令表示文件的结束,不会再进行任何处理。我在这里错过了什么吗?

标签: assemblyllvmgnu-assemblerpowerpc

解决方案


这似乎是 GNU 汇编器的一个未记录的特性。显然它用于以 ECOFF 格式发出调试信息。见gas/config/obj-ecoff.c:259gas/ecoff.c:2981

/* ECOFF specific debugging information.  */
{ "aent",     ecoff_directive_ent,    1 },
{ "begin",    ecoff_directive_begin,  0 },
{ "bend",     ecoff_directive_bend,   0 },
{ "end",      ecoff_directive_end,    0 },

推荐阅读