public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: Link start address
       [not found] <1186161144.23564.126.camel@shap.om-md.eros-os.com>
@ 2007-08-03 17:30 ` Ramana Radhakrishnan
  2007-08-03 17:44   ` Jonathan S. Shapiro
  0 siblings, 1 reply; 3+ messages in thread
From: Ramana Radhakrishnan @ 2007-08-03 17:30 UTC (permalink / raw)
  To: Jonathan S. Shapiro; +Cc: binutils

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.

If you were however writing your own standalone linker script you'd do a
. = <startaddress> in your linker script.

>
> 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

cheers
Ramana


>
> This is an ELF target. If we simply issue a --section-start for
> the .init section from GCC, will the other sections get adjusted
> accordingly under the generic linker script, or do we need to do
> something more involved?
>
> If it's more involved, where to look?
>
> Bother. I used to know how to do this. :-)
>
>
> shap
>
>


-- 
Ramana Radhakrishnan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Link start address
  2007-08-03 17:30 ` Link start address Ramana Radhakrishnan
@ 2007-08-03 17:44   ` Jonathan S. Shapiro
  2007-08-03 23:12     ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan S. Shapiro @ 2007-08-03 17:44 UTC (permalink / raw)
  To: Ramana Radhakrishnan; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Link start address
  2007-08-03 17:44   ` Jonathan S. Shapiro
@ 2007-08-03 23:12     ` Ian Lance Taylor
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2007-08-03 23:12 UTC (permalink / raw)
  To: Jonathan S. Shapiro; +Cc: Ramana Radhakrishnan, binutils

"Jonathan S. Shapiro" <shap@eros-os.com> writes:

> Isn't TEXT_START_ADDRESS the same as the address specified by the -Ttext
> option?

No, it isn't.  TEXT_START_ADDRESS changes how the linker script lays
out sections.  -Ttext does not.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-03 23:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1186161144.23564.126.camel@shap.om-md.eros-os.com>
2007-08-03 17:30 ` Link start address Ramana Radhakrishnan
2007-08-03 17:44   ` Jonathan S. Shapiro
2007-08-03 23:12     ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).