Re: [cc65] linker cfg files

Date view Thread view Subject view

From: Groepaz (
Date: 2003-04-25 00:33:50

On Thursday 24 April 2003 23:03, Ullrich von Bassewitz wrote:

> > i fail to see the problem with that :o)
> It violates 2.: Needs extensions and is not easy. How is the linker
> supposed to know that __STACKSIZE__ defines the size of the stack? This is
> what I mean with expressions, a reasonable implementation would need
> something like
>     RAM: start = $7FF, size = $c001, define = yes, file = %O;
>     STACK: start = __RAM_START__ + __RAM_SIZE__, size = __STACKSIZE__,
>            define = yes, file = "";
>     ...
> }

exactly what i said, you insist on doing the dodgy calculation as is, but in 
the linker script :) i say its not needed. tell the linker to read the size 
from the symbols and all is fine. please explain why you think what i say is 
not sufficient coz i really dont get it. except that other linkers work like 
you say, what is the reason not to do it like i suggested? ofcoz the linker 
can know about __STACKSIZE__ if you tell him, it must read the linkerscript 
at first (unless my understanding of the inner workings of the linker is 
totally wrong) and then it knows about the values of defined symbols. it can 
then link everything, including the stack segment (whose size is known). it 
only needs to know that the heap segment gets linked last, since the linker 
must know the remaining space in the memory area you load the heap segment 
into. (if the heap size is specified in linkerscript, heap can be linked like 
any other segment). 

however, if you just dont like the idea of having a few things like 
"__STACKSIZE__" hardcoded in the linker (your comment suggests that :=)) and 
would prefer the generic (imho overkill here) approach you will indeed need 
expressions and calculate things in the linkerscript like you say....i'm not 
quite sure if that wouldnt be shooting a fly with a cannonball though :=) no 
doubt, beeing able to use expressions would add a LOAD of flexibility over my 
simple approach...the question is, what would be impossible with the simple 
variant and how much would that rare exception justify the lot of work for 
the implementation of the expression stuff...i dont quite recall ever having 
calculated anything but stack/heap stuff in linkerscripts to be honest (and 
i've written a bunch of them for various consoles etc)

oh well :=P maybe i just like kludges in linkercode better than in the library 
:=) (this hax0red _heap.s in nes stuff really sux eh? :=P)


To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.

Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-04-25 00:40:30 CEST