Linker scripts
Michael Eager
eager@eagercon.com
Sat Sep 9 02:11:00 GMT 2006
Andrew Pinski wrote:
> On Wed, 2006-09-06 at 15:00 -0700, Michael Eager wrote:
>> GCC passes a linker script to the linker for some
>> targets (e.g., powerpc-eabi with -mads). If you specify a
>> linker script using -Wl,-T,script.ld, you get both
>> passed to the linker and there may be conflicts.
>>
>> Is there any option to GCC which says to not pass
>> the predefined linker script to the linker?
>
> sysv4.h has "%{!Wl,-T*: %{!T*: %(link_start) }}" which should mean don't
> do link_start (which contains the -T for -mads) when supplying -T or
> -Wl,-T. Now is it really working is different story.
This works for -Tsscript.ld, but not for -Wl,-Tscript.ld.
(I also noticed similar usage of %{Wa*:, in ASM specs which also
would have a problem but the special handling that removes assembler
options and passes them to the assembler does essentially
what the ASM spec would have done.)
Linker options specified by -Wl are moved to the file list
so that they are passed on to the linker after the files.
Other options for the linker (like -x<linkeropt>) are moved
to a linker option list. When the spec is processed, the
switches list doesn't contain "-Wl.-T", so the test always fails.
I can look for "-Wl,-T,script.ld" and "-Wl,-T -Wl,script.ld"
and translate them into "-Tscript.ld" in process_command().
This feel like a bit of a kludge, especially since -T is
undocumented. Where %{T} is used, it is an assembler option
which doesn't take an argument.
Anyone have a different idea?
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
More information about the Gcc
mailing list