Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The GNU linker. - <b>the location counter</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
The Location Counter
--------------------

   The special linker variable "dot" `.' always contains the current
output location counter. Since the `.' always refers to a location in
an output section, it must always appear in an expression within a
`SECTIONS' command. The `.' symbol may appear anywhere that an ordinary
symbol is allowed in an expression, but its assignments have a side
effect. Assigning a value to the `.' symbol will cause the location
counter to be moved.  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, `file1' is located at the beginning of the
output section, then there is a 1000 byte gap.  Then `file2' appears,
also with a 1000 byte gap following before `file3' is loaded.  The
notation `= 0x1234' specifies what data to write in the gaps (*note
Section Options::.).


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson