This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linker script question and/or bug


Nick Clifton wrote:
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

That works. But if you specify the options in the reverse order, it fails.

I'll post a patch which moves processing user-specified
linker scripts to the same place as default linker scripts.

--
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]