public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Why no expressions in MEMORY command?
@ 2005-04-12  3:41 Charles Manning
  2005-04-12  8:40 ` Alan Modra
  2005-04-13 23:30 ` Peter Barada
  0 siblings, 2 replies; 6+ messages in thread
From: Charles Manning @ 2005-04-12  3:41 UTC (permalink / raw)
  To: binutils

It seems you can only use hard-coded values in a MEMORY command. 

Why can't you use scripts ike:


EXT_RAM_START = ...
EXT_RAM_SIZE = ......

MEMORY
{
    ext_ram:  ORIGIN = EXT_RAM_START, LENGTH = EXT_RAM_SIZE
}

This can make things a lot easier...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why no expressions in MEMORY command?
  2005-04-12  3:41 Why no expressions in MEMORY command? Charles Manning
@ 2005-04-12  8:40 ` Alan Modra
  2005-04-12 13:02   ` Dave Korn
  2005-04-13 23:30 ` Peter Barada
  1 sibling, 1 reply; 6+ messages in thread
From: Alan Modra @ 2005-04-12  8:40 UTC (permalink / raw)
  To: Charles Manning; +Cc: binutils

On Tue, Apr 12, 2005 at 03:41:19PM +1200, Charles Manning wrote:
> Why can't you use scripts ike:

Because no one has cared enough to write support to handle such symbols
in linker scripts.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Why no expressions in MEMORY command?
  2005-04-12  8:40 ` Alan Modra
@ 2005-04-12 13:02   ` Dave Korn
  2005-04-12 20:22     ` Linus Nielsen Feltzing
  2005-04-12 21:47     ` Charles Manning
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Korn @ 2005-04-12 13:02 UTC (permalink / raw)
  To: 'Alan Modra', 'Charles Manning'; +Cc: binutils

----Original Message----
>From: Alan Modra
>Sent: 12 April 2005 09:41

> On Tue, Apr 12, 2005 at 03:41:19PM +1200, Charles Manning wrote:
>> Why can't you use scripts ike:
> 
> Because no one has cared enough to write support to handle such symbols
> in linker scripts.


  FYI:  I looked into it in some depth once; it would require quite a hefty
bit of patching, since the information about symbol values isn't evaulated
yet at the time the parser is reading the MEMORY command.  See PR ld/518 
http://sourceware.org/bugzilla/show_bug.cgi?id=518, also see
http://sources.redhat.com/ml/binutils/2004-03/msg00540.html
for a detailed analysis, and 
http://sources.redhat.com/ml/binutils/2004-03/msg00571.html
for a suggested solution.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why no expressions in MEMORY command?
  2005-04-12 13:02   ` Dave Korn
@ 2005-04-12 20:22     ` Linus Nielsen Feltzing
  2005-04-12 21:47     ` Charles Manning
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Nielsen Feltzing @ 2005-04-12 20:22 UTC (permalink / raw)
  To: binutils

Dave Korn wrote:
>   FYI:  I looked into it in some depth once; it would require quite a hefty
> bit of patching, since the information about symbol values isn't evaulated
> yet at the time the parser is reading the MEMORY command.

In the Rockbox project, we use the C preprocessor on the linker command
files. That way we can use #define, #ifdef and so on. Very useful.

Linus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why no expressions in MEMORY command?
  2005-04-12 13:02   ` Dave Korn
  2005-04-12 20:22     ` Linus Nielsen Feltzing
@ 2005-04-12 21:47     ` Charles Manning
  1 sibling, 0 replies; 6+ messages in thread
From: Charles Manning @ 2005-04-12 21:47 UTC (permalink / raw)
  To: Dave Korn, 'Alan Modra'; +Cc: binutils


> > Because no one has cared enough to write support to handle such symbols
> > in linker scripts.
Maybe I care enough to have a crack at this:-)

>
>   FYI:  I looked into it in some depth once; it would require quite a hefty
> bit of patching, since the information about symbol values isn't evaulated
> yet at the time the parser is reading the MEMORY command.  See PR ld/518
> http://sourceware.org/bugzilla/show_bug.cgi?id=518, also see
> http://sources.redhat.com/ml/binutils/2004-03/msg00540.html
> for a detailed analysis, and
> http://sources.redhat.com/ml/binutils/2004-03/msg00571.html
> for a suggested solution.

Hmmm bummer. It seems to come down to there being no distinction between 
expressions that can be evaluated before symbols are produced and others.

This makes the MEMORY stuff relatively limitied in its utility. There are 
work arounds, but they are far from elegant.


-- Charles



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why no expressions in MEMORY command?
  2005-04-12  3:41 Why no expressions in MEMORY command? Charles Manning
  2005-04-12  8:40 ` Alan Modra
@ 2005-04-13 23:30 ` Peter Barada
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Barada @ 2005-04-13 23:30 UTC (permalink / raw)
  To: manningc2; +Cc: binutils


>It seems you can only use hard-coded values in a MEMORY command. 
>
>Why can't you use scripts ike:
>
>
>EXT_RAM_START = ...
>EXT_RAM_SIZE = ......
>
>MEMORY
>{
>    ext_ram:  ORIGIN = EXT_RAM_START, LENGTH = EXT_RAM_SIZE
>}
>
>This can make things a lot easier...

You can always *generate* the linker script using other tools (sh,
cpp, perl, etc).

-- 
Peter Barada
peter@the-baradas.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-04-13 23:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-12  3:41 Why no expressions in MEMORY command? Charles Manning
2005-04-12  8:40 ` Alan Modra
2005-04-12 13:02   ` Dave Korn
2005-04-12 20:22     ` Linus Nielsen Feltzing
2005-04-12 21:47     ` Charles Manning
2005-04-13 23:30 ` Peter Barada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).