This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Variables in linker script
On 22/09/2010 02:11, Alan Modra wrote:
> On Tue, Sep 21, 2010 at 01:43:17PM +0200, Nikola Ikonic wrote:
>> First, I would like to ask if there is a table of variables in linker?
>
> No. Symbol values are held in the main linker symbol table. Linker
> script (and --defsym) values are set by lang_do_assignments. This
> happens too late to use their values in statements setting section
> addresses. Running lang_do_assignments earlier is possible but you
> will likely need to fix quite a lot of fallout.
>
As an alternative to rewriting the linker, what a lot of people do is use
the C pre-processor to generate a linker script from a template (as part of a
makefile), that way you can use #defines for/instead of/as well as symbol
definitions.
cheers,
DaveK