Linker script question and/or bug
Nick Clifton
nickc@redhat.com
Sun Dec 24 03:33:00 GMT 2006
Hi Michael,
> This works if the symbol is defined before the linker
> script, but not if it is in the other order:
>
> Works: ld -defsym _START=0x8000000 -Tscript.ld
> Fails: ld -Tscript.ld -defsym _START=0x8000000
>
> This is because the linker script is parsed as soon
> as the -T option is seen, rather than after all command
> line options are processed. This is a problem because
> gcc doesn't treat the default linker script the same
> as one specified as a linker option: the default
> linker script is passed early on the command line,
> while options specified by -Wl,... are tagged on at
> the end of the command line.
Why not pass the linker script name as a gcc command line option as
well. ie:
gcc -Wl,-defym,_START=0x800000 -Wl,-Tscript.ld
Cheers
Nick
More information about the Binutils
mailing list