The NASM Documentation describes the special tokens $
and $$
:
NASM supports two special tokens in expressions, allowing calculations to involve the current assembly position: the $ and $$ tokens. $ evaluates to the assembly position at the beginning of the line containing the expression; so you can code an infinite loop using JMP $. $$ evaluates to the beginning of the current section; so you can tell how far into the section you are by using ($-$$).
I understand how to overcome the lack of $
in GNU Assembly - by declaring a label on the preceding line and using its address:
xgrndsize equ $ - xgrnd
becomes:
xgrnd_end:
.set xgrndsize, xgrnd_end - xgrnd
How can I obtain the address of the current section without $$
?