MEMORY commands in link scripts

Jon Beniston jbeniston@compxs.com
Fri Nov 5 11:59:00 GMT 2004


Hi,

Is there any way to either use non-constants for the ORIGIN or LENGTH values
in a MEMORY command, or some how access these values else where in a link
script. What I would like to be able to do is, something like:

base = 0x100;
size = 0x100;

MEMORY {
  ram (rw) : ORIGIN = base, LENGTH = size;
}

...

SECTIONS {
   PROVIDE(_fstack = base + size - 4)
}

Or, alternatively:

SECTIONS {
   PROVIDE(_fstack = ORIGIN(ram) + LENGTH(ram) - 4)
}

To put it another way, I would like to be able to override the size /
position of a memory from the command line.

Cheers,
Jon




More information about the Binutils mailing list