Search code examples
assemblymacrosarm

Why there is '\' before the parameters in the arm assembly macro?


    .macro  str_l, src, sym, tmp
#ifndef MODULE
    adrp    \tmp, \sym
    str \src, [\tmp, :lo12:\sym]
#else
    adr_l   \tmp, \sym
    str \src, [\tmp]
#endif
    .endm

Above is part of code in the arch/arm64/include/asm/assembler.h. And there is \ before all the parameters. Are they just used to show the names are parameter?


Solution

  • Yes, that's how macros work in the GNU assembler, as explained in its manual. clang is generally compatible with GNU as in such things.

    The backslash indicates that this use of the macro parameter name should be substituted with its value.