This is the mail archive of the binutils@sources.redhat.com 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: Linker question


Hi Sumesh,

>    As part of a project Iam involved in, I need to maintain copies
> of the same variable in different memory banks (kind of like
> cache). I then want to based on criteria I have address the
> different copies at different program points.

This sounds like a very strange scheme.  How do you intend to keep the
variables in sync ?  ie if a program changes variable A in bank1, how
do make sure that the copy of variable A in bank2 also changes ?

> 1. Where is the exact address being generated.

For most cases the addresses are generated in the linker.  Depending
upon the target processor's instruction set and the form of addressing
being used the addresses can also sometimes be computed in the
assembler or in the loader.

In your situation however, the most likely place where the addresses
are computed is the function "mcore_elf_relocate_section" which is
defined in bfd/elf32-mcore.c


> 2. As an alternative , can I handle such a scheme through a script, in
> other words can the script be used to guide such an addressing.

You might be able to do something clever using linker scripts and
overlays although I do not think that they are really designed to
handle this kind of thing.

I would suggest however that you consider very carefully if you really
want multiple copies of the same variable at different addresses,
since this is not something that the assembler or linker are really
designed to allow.

Cheers
        Nick
        


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