Link start address
Jonathan S. Shapiro
shap@eros-os.com
Fri Aug 3 17:44:00 GMT 2007
On Fri, 2007-08-03 at 23:00 +0530, Ramana Radhakrishnan wrote:
> Redirecting it there ...
>
> On 8/3/07, Jonathan S. Shapiro <shap@eros-os.com> wrote:
> > This is probably a question that should be directed to the binutils
> > list.
> >
> > We need to set the default link start address used by ld. Unfortunately
> > ld doesn't have a nice porting guide like GCC does. :-)
>
> Look at emulparams/*.sh and scriptempl/*.sc in the ld directory in
> binutils sources. You would need to set up TEXT_START_ADDRESS
> depending on your target to the correct address. Its a bunch of shell
> scripts that run to generate the default linker script and the
> corresponding start addresses.
Isn't TEXT_START_ADDRESS the same as the address specified by the -Ttext
option? If so, this is not sufficient. It causes the text section to
move, but it does not cause the following sections (data, bss) to be
adjusted. What I am looking for is a simple way to lower all of them.
I will look at the places you mention.
>
> If you were however writing your own standalone linker script you'd do a
> . = <startaddress> in your linker script.
Yes. That I knew about.
> > Actually, we need to choose one of two possible start addresses based on
> > command line options to GCC, and I am wondering if this may make things
> > more complicated.
>
> You might want to have different linker options chosen - you could
> have different emul targets depending on the command line option you
> choose. You can control this using LINK_SPEC in the gcc driver .
>
> hope this helps
I was really hoping to avoid multiple emul targets, but I suppose that I
should look at that. :-(
Thanks again.
shap
More information about the Binutils
mailing list