From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2543 invoked by alias); 5 Nov 2004 12:55:18 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 2536 invoked from network); 5 Nov 2004 12:55:16 -0000 Received: from unknown (HELO NUTMEG.CAM.ARTIMI.COM) (217.40.111.177) by sourceware.org with SMTP; 5 Nov 2004 12:55:16 -0000 Received: from mace ([192.168.1.25]) by NUTMEG.CAM.ARTIMI.COM with Microsoft SMTPSVC(6.0.3790.211); Fri, 5 Nov 2004 12:54:17 +0000 From: "Dave Korn" To: , Subject: RE: MEMORY commands in link scripts Date: Fri, 05 Nov 2004 12:55:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <000d01c4c32e$e2a25d60$0bbda8c0@Kindrogan> Message-ID: X-OriginalArrivalTime: 05 Nov 2004 12:54:17.0656 (UTC) FILETIME=[8F827B80:01C4C336] X-SW-Source: 2004-11/txt/msg00100.txt.bz2 > -----Original Message----- > From: binutils-owner On Behalf Of Jon Beniston > Sent: 05 November 2004 11:59 > 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. Alas no. Although the documentation suggests this should be possible, it isn't. See http://sources.redhat.com/ml/binutils/2004-03/msg00540.html http://sources.redhat.com/ml/binutils/2004-03/msg00571.html for detailed explanation. The docs should be updated. I've filed a bugzilla report. Should have done so months ago. Sorry all. http://sources.redhat.com/bugzilla/show_bug.cgi?id=518 Your best bet would be to work around it in your build system, perhaps by building a linker script as a make target, or perhaps you could use multiple -T options, and do something like echo "base = ${BASE}" > ldscript.tmp echo "size = ${SIZE}" >> ldscript.tmp echo "MEMORY {" >> ldscript.tmp echo " ram (rw) : ORIGIN = ${BASE}, LENGTH = ${SIZE};" >> ldscript.tmp echo "}" >>ldscript.tmp then have a main linker script that has all the unchanging parts in it: --------------------ldscript.main-------------------- .... SECTIONS { PROVIDE(_fstack = base + size - 4) } .... --------------------ldscript.main-------------------- and on your link command line, use "-T ldscript.tmp -T ldscript.main" to assemble the two parts into one script. cheers, DaveK -- Can't think of a witty .sigline today....