在此内联程序集中,“%object”和“@object”是什么意思?

What does the "%object" and "@object" mean in this inline assembly?

下面的代码引用自这里 line 453:

#define GEN_ABSOLUTE_SYM_KCONFIG(name, value)       \
    __asm__(".globl\t" #name                    \
        "\n\t.equ\t" #name "," #value       \
        "\n\t.type\t" #name ",%object")

对于这样的事情:

GEN_ABSOLUTE_SYM_KCONFIG(CONFIG_I2C, 1); 

我认为它应该扩展到:

 .globl      CONFIG_I2C
             .equ          CONFIG_I2C,1
             .type         CONFIG_I2C,%object

我可以理解 #name#value 只是 Stringizing

但是 %object 是什么意思?

object 不是 GEN_ABSOLUTE_SYM_KCONFIG 宏的形式参数。

为什么会在这里? % 是什么意思?它似乎是特定于手臂的。

而在 line 465 中,对于 x86,%object 更改为 @object

#define GEN_ABSOLUTE_SYM_KCONFIG(name, value)       \
    __asm__(".globl\t" #name                    \
        "\n\t.equ\t" #name "," #value       \
        "\n\t.type\t" #name ",@object")

"%object"" 是指定符号“type”的 GAS 汇编指令:

来自 Binutils 文档:

https://sourceware.org/binutils/docs/as/Type.html

For ELF targets, the .type directive is used like this:

.type name , type description This sets the type of symbol name to be either a function symbol or an object symbol.

更一般地说:

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/useful-assembler-directives-and-macros-for-the-gnu-assembler

The .type directive allows you to tell the assembler what type a symbol is. Most of the time we just use %function and %object.