This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Link start address
- From: "Jonathan S. Shapiro" <shap at eros-os dot com>
- To: Ramana Radhakrishnan <ramana dot r at gmail dot com>
- Cc: binutils <binutils at sources dot redhat dot com>
- Date: Fri, 03 Aug 2007 13:44:17 -0400
- Subject: Re: Link start address
- References: <1186161144.23564.126.camel@shap.om-md.eros-os.com> <67ea2eb0708031030v4e016671gf976815459a55cbc@mail.gmail.com>
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