This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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 scripts


Segher Boessenkool wrote:
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.

Sorry, I'm not interested in some theoretical general solution which might handle every possible linker script.

A linker script passed to the gcc driver should override the one
which the driver would pass by default.  The linker script which is
specified must be, as you say, close enough to the standard script
that things will work correctly.

In the real world, linker scripts may be generated automatically
to describe the memory layout of a board or processor.  There is
no compelling reason to prohibit this *correct* linker script from
being passed to the gcc driver and from there to ld.

--
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]