"defines" in linker script

Dave Korn dk@artimi.com
Thu Mar 25 22:08:00 GMT 2004


> -----Original Message-----
> From: binutils-owner On Behalf Of Massimiliano Cialdi
> Sent: 25 March 2004 15:35

> I want something like:
> 
> VDIM = 2K;
> 
> MEMORY
> {
> 	rom_vect : ORIGIN = 0x00000000, LENGTH = VDIM
> 	rom      : ORIGIN = VDIM,       LENGTH = 256K - VDIM
> 	ext_ram  : ORIGIN = 0x00420000, LENGTH = 131072
> 	ram      : ORIGIN = 0x00FFB000, LENGTH = 16320
> 	ram1     : ORIGIN = 0x00FFFFC0, LENGTH = 64
> }

  Hey!  So do I!  I just posted the same thing yesterday!

> obviously this doesn't work. ld report
> "nonconstant expression for length"

  It's supposed to work: the docs claim that you should be able to use any
expression that is well-defined before the memory allocation stage, which
your symbol looks like to me.

> So I wonder if there is something like #define in linker script.

  What you've written is apparently meant to work.  I believe it's a bug in
ld.  See
http://sources.redhat.com/ml/binutils/2004-03/msg00540.html 
for an in-depth analysis of exactly why it doesn't work; as to a solution,
I'm not very clear how to proceed.



    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....



More information about the Binutils mailing list