This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: linking question
- To: Nick Papadonis <npapadon at yahoo dot com>
- Subject: Re: linking question
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 22 May 2001 18:23:12 +0100
- Cc: binutils at sourceware dot cygnus dot com
- References: <m3r8xh79qm.fsf@yahoo.com>
Hi Nick
> I'm trying to link a symbol into my program and am having trouble.
> The following code is from my crt0.S and the symbol _start is
> declared. When my program is linked, ld does NOT place _start at the
> specified location in the linker script.
What location does it assign to the symbol ?
What command line are you using to invoke the linker ?
Symbols defined in linker scripts can be overrideen by definitions in
incoming object files. So if you have _start in your crt0.o file then
its definition (and location) will override the definition in the
linker script.
My suggestion - remove the definition of _start from the linker
script, and just accept the position assigned to it by the linker when
the link is performed. If, for some reason, you have to start
executing code from a fixed address, (presumably 0x400 from your
example), then insist that crt0.o is the first object file on the
linker's command line.
Cheers
Nick