This is the mail archive of the 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: [Gold] Can't we specify input files & libraries in linker scripts ?

> Thanks, cary, It's ok to put the input files & libraries on the command
> line, but it's inconvenient to the end user, such as :
> crt0 -lm -lc -lgloss_mspu -lcompiler_rt inputfile.o

These extra files are usually provided by the compiler driver (e.g.,
gcc). It's uncommon to run the linker directly except when building
kernels and other embedded applications.

Libraries should typically follow the application's object files. For
archive libraries in particular, they must follow any objects that
reference them, or the linker will pull nothing out of them. In
general, the link command line should be ordered so that if A has a
reference to a symbol in B, A precedes B on the command line. If the
compiler driver provide the standard libraries, it can put them in the
correct order relative to the application's object files.

> If we can specify the default files & libraries(such as crt0, -lc,
> -lgloss_mspu -lcompiler_rt) in a linker script, say script.ld, it will be
> more concise:
> -T script.ld inputfile.o

Gold, unlike Gnu ld, was designed to avoid the need for any linker
script for normal applications. I wouldn't recommend this approach.
But as I said, if you just leave off the -T option and put your script
as a regular input file, it should work. (On Linux, for example, isn't actually a library -- it's a script file that points to
a group of separate object files.)


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