ADDR

The ADDR function returns the address of the named section or memory segment.

Prototype

  ADDR (sectionName | segmentName | symbol) 

In the example below, ADDR is used to assign the address of ROOT to the symbol __rootbasecode.

Example

 MEMORY{

    ROOT  (RWX) : ORIGIN = 0x8000, LENGTH = 0

}



SECTIONS{

  .code :

  {

  __rootbasecode = ADDR(ROOT);

     *(.text);

  } > ROOT

}
Note: In order to use segmentName with this command, the segmentName must start with the period character even though segmentNames are not required to start with the period character by the linker, as is the case with sectionName.