9.6.3 The Location Counter

The special linker variable represented by a dot (.) always contains the current output location counter. Since the . variable always refers to a location in an output section, it may only appear in an expression within a SECTIONS command. In expressions, the . symbol may appear anywhere an ordinary symbol is permitted.

Assigning a value to . will cause the value of the location counter to be changed and affect the location of any subsequent output. This may be used to create holes in the output section. The location counter may never be moved backwards.
SECTIONS
{
  output :
    {
      file1(.text)
      . = . + 1000;
      file2(.text)
      . += 1000;
      file3(.text)
    } = 0x1234;
}

In the previous example, the .text section from file1 is located at the beginning of the output section output. It is followed by a 1000 byte gap. Then the .text section from file2 appears, also with a 1000 byte gap following before the .text section from file3. The notation = 0x1234 specifies what data to write in the gaps.

The . variable actually refers to the byte offset from the start of the current containing object. Normally this is the SECTIONS statement, whose start address is 0, hence the . variable can be used as an absolute address. If the . variable is used inside a section description, however, it refers to the byte offset from the start of that section, not an absolute address. So, in a script like this:
SECTIONS
{
    . = 0x100
    .text: {
      *(.text)
      . = 0x200
    }
    . = 0x500
    .data: {
      *(.data)
      . += 0x600
    }
}
the .text section will be assigned a starting address of 0x100 and a size of exactly 0x200 bytes, even if there is not enough data in the .text input sections to fill this area. (If there is too much data, an error will be produced because this would be an attempt to move the . variable backwards). The .data section will start at 0x500 and it will have an extra 0x600 bytes worth of space after the end of the values from the .data input sections and before the end of the .data output section itself.