Issue
Below code is quoted from here 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")
For something like this:
GEN_ABSOLUTE_SYM_KCONFIG(CONFIG_I2C, 1);
I think it should expand to:
.globl CONFIG_I2C
.equ CONFIG_I2C,1
.type CONFIG_I2C,%object
I can understand that the #name
and #value
are just Stringizing.
But what does the %object
mean?
The object
is not a formal parameter of the GEN_ABSOLUTE_SYM_KCONFIG
macro.
Why is it here? And what does the %
mean? It seems to be arm specific.
And in line 465, the %object
changes to @object
for x86.
#define GEN_ABSOLUTE_SYM_KCONFIG(name, value) \
__asm__(".globl\t" #name \
"\n\t.equ\t" #name "," #value \
"\n\t.type\t" #name ",@object")
Solution
"%object"" is a GAS assembler directive specifying a symbol "type":
From the Binutils documentation:
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.
More generally:
The .type directive allows you to tell the assembler what type a symbol is. Most of the time we just use %function and %object.
Answered By - paulsm4