Excerpt from info as
(GNU Binutils 2.21.90), or online in the GAS manual: https://sourceware.org/binutils/docs/as/Dot.html
5.4 The Special Dot Symbol
The special symbol
.
refers to the current address thatas
is
assembling into. Thus, the expressionmelvin: .long .
defines
melvin
to contain its own address.Assigning a value to
.
is treated the same as a.org
directive.
Thus, the expression.=.+4
is the same as saying.space 4
.
msg: .ascii "Hello World!\n" # not zero-terminated, use .asciz for that
msglen = . - msg # A .equ directive would be equivalent
This is a GAS version of the same idiom used in NASM (len equ $ - symbol
) to get the assembler to calculate the length of something for you.