This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Variables in linker script


Hello all,

thanks for your replies. Dave, would it be possible to create a
preprocessor file which would create linker scripts which do some kind
of arithmetics with variables? I made an example with OR = 0x40132d00;

but what if would have

LEN = 0x5000;
OR = 0x40132d00;
End = OR+LEN;

MEMORY
{
 /*These commands describe block locations (execution area)*/
 MODULE2      : ORIGIN = OR, LENGTH = END;
}"

Or there could be some other kind of arithmetics (multiplying etc).

Thank you in advance.

Best regards,
          Nikola


On Wed, Sep 22, 2010 at 6:23 AM, Dave Korn <dave.korn.cygwin@gmail.com> wrote:
> 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
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]