DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
COFF link editor

Specifying a memory configuration

MEMORY directives are used to specify:

If no directives are supplied, ld assumes that all memory is configured. The size of the default memory is dependent upon the target machine.

MEMORY directives are used to assign a name to a virtual address range. This range is described by specifying its origin and length. Output sections can then be bound to virtual addresses within specifically named memory areas. Memory names can be up to 8 characters long and may contain uppercase or lowercase letters, digits, and the characters ``$'', ``.'', and ``_''. Names of memory ranges are used only by ld and are not carried in the output file symbol table or headers.

The syntax of the MEMORY directive is as follows:

      MEMORY
      {
            name1 (attr) :	origin = n1, length = n2
            name2 (attr) :	origin = n3, length = n4
   .
   .
   .
      }
For example:
      MEMORY
      {
              mem1:          origin=0x000000,    length=0x10000
              mem2 (RW):     origin=0x020000,    length=0x40000
      }
The keyword origin (or org or o) must precede the origin of a memory range, and length (or len or l) must precede the length as shown in the above example. The origin operand refers to the virtual address of the memory range. The origin and length are entered as long integer constants in either decimal, octal, or hexadecimal. The origin and length specifications, as well as individual MEMORY directives, may be separated by white space or a comma.

Attributes may be associated with a named memory area. These attributes follow the memory area name and are enclosed in parentheses. The attributes that may be specified are:

If no attributes are specified on a MEMORY directive or if no MEMORY directives are supplied, memory areas assume all of the attributes R, W, X, and I.

By way of MEMORY directives, ld(CP) can be told that memory is configured in some manner other than the default. If MEMORY directives are used, all virtual memory not described in some MEMORY directive is considered to be unconfigured. Unconfigured memory is not used in ld's allocation process: nothing except DSECT sections (discussed later) can be link edited or bound to an address within unconfigured memory. For example, it may be necessary to prevent anything from being linked to the first 0x10000 words of memory. This can be accomplished by using MEMORY directives that do not mention that portion of memory.


Next topic: Section definition directives
Previous topic: Types of expression values

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003