linking question
Nick Clifton
nickc@cambridge.redhat.com
Tue May 22 09:26:00 GMT 2001
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
More information about the Binutils
mailing list