This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: The gnu linker.
- From: mike stump <mrs at windriver dot com>
- To: craig dot wright at cometsolutions dot com, gcc at gnu dot org
- Date: Wed, 2 Jan 2002 19:08:51 -0800 (PST)
- Subject: Re: The gnu linker.
> From: "Craig W. Wright" <craig.wright@cometsolutions.com>
> To: gcc@gnu.org
> Date: 02 Jan 2002 20:34:08 -0700
> I'm not entirely sure, but I think the GNU linker comes in the
> package with gcc.
Nope, has almost no relationship to gcc, except that gcc usually uses
that linker and the GNU thing, and the FSF thang.
Please read the documentation that comes with ld for contacting them.
>From the ld docs:
@item INPUT(@var{file}, @var{file}, @dots{})
@itemx INPUT(@var{file} @var{file} @dots{})
@kindex INPUT(@var{files})
@cindex input files in linker scripts
@cindex input object files in linker scripts
@cindex linker script input object files
The @code{INPUT} command directs the linker to include the named files
in the link, as though they were named on the command line.
For example, if you always want to include @file{subr.o} any time you do
a link, but you can't be bothered to put it on every link command line,
then you can put @samp{INPUT (subr.o)} in your linker script.
In fact, if you like, you can list all of your input files in the linker
script, and then invoke the linker with nothing but a @samp{-T} option.
Also, most people put the files into a .a and link against it,
millions of files can be referenced with one name. Further, you can use your
imagination, and come up with things like:
find . -name \*.o -print | xargs echo | while read a; do ld -r -o np.o partial.o $a; mv np.o partial.o; done
to solve the problem.