Linker scripts
Segher Boessenkool
segher@kernel.crashing.org
Sun Sep 10 20:40:00 GMT 2006
>> If you use your own linker scripts, you really shouldn't use gcc
>> to do the linking step; call ld directly, instead. gcc has no
>> idea what your linker script does, so it might well call ld with
>> the wrong options...
>
> There are a number of targets which pass linker scripts
> to ld, along with whatever libraries or support files
> (like crti.o) are needed. The spec file insures that
> the correct options are passed.
No it doesn't, it cannot possibly know _what_ the correct options
are, nor whether it should pass library or startup file references.
Sure, for some linker scripts that are close enough to the "standard"
linker scripts, this might work (modulo the bug in the spec file
the original poster seems to hit), but in general, it cannot.
The only way to be sure if calling the linker via GCC when doing
non-standard linking things will work correctly, is to look at all
the arguments that are passed to ld; the only way to make sure it
_will_ work correctly is to pass those arguments yourself, directly
to ld.
Segher
More information about the Gcc
mailing list