This is the correct syntax for a gas macro. It uses no parameters. The 3 instructions are correct as written.
The is that your as
is not GNU. It's a distant relative, with a lot of modifications by Apple, so you can't rely on the GNU documentation to explain anything. For example, try to look up the -arch
option in the GNU documentation... it doesn't exist.
You're going to have to refer to Apple's documentation. They keep a copy of it here: https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/Assembler/
One simple difference difference is that they have changed the end-of-macro directive from .endm
to .endmacro
. Besides that, yes it looks like they replace $0
, $1
, and so on with macro arguments instead of using named arguments like GNU as does. And they don't tell you how to include a literal $
in the macro output! (How did the documentation author overlook this question? It can't be a rare thing to want to do)
In summary, since Apple has modified the assembler with a completely different macro syntax and failed to document it properly we're left guessing. I'd try putting a space after each dollar sign, hoping that will get them through the macro process unharmed while not damaging their ability to be recognized as immediate operand signifiers. If that didn't work, my next attempt would be putting a backslash before the dollar sign, then doubling the dollar sign, then finding out whether the real GNU assembler can be installed on MacOS instead of the hacked-and-underdocumented Apple version...