Search code examples
assemblysyntaxgnusymbolsgnu-assembler

What does ". =" mean in GAS


I'm examining the GNU GRUB source code and in /grub-core/boot/i386/pc/*.S files, there are a lot of .= markers. Here is one from /grub-core/boot/i386/pc/boot.S file (line 409-414):

    /*
     *  Windows NT breaks compatibility by embedding a magic
     *  number here.
     */

    . = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC

What I want to know is what the .= means.


Solution

  • In GAS, and perhaps in other assemblers as well, the special symbol . refers to the current address that the assembler will assemble into. A statement such as the one above controls where the bytes for the following code will get assembled.

    The documentation for the . operator is here.