BBS水木清华站∶精华区
LINKER OPTIONS
These options come into play when the compiler links ob-
ject files into an executable output file. They are mean-
ingless if the compiler is not doing a link step.
object-file-name
A file name that does not end in a special recog-
nized suffix is considered to name an object file
or library. (Object files are distinguished from
libraries by the linker according to the file con-
tents.) If GCC does a link step, these object
files are used as input to the linker.
-llibrary
Use the library named library when linking.
The linker searches a standard list of directories
for the library, which is actually a file named
`liblibrary.a'. The linker then uses this file as
if it had been specified precisely by name.
The directories searched include several standard
system directories plus any that you specify with
`-L'.
Normally the files found this way are library
files--archive files whose members are object
files. The linker handles an archive file by scan-
ning through it for members which define symbols
that have so far been referenced but not defined.
However, if the linker finds an ordinary object
file rather than a library, the object file is
linked in the usual fashion. The only difference
between using an `-l' option and specifying a file
name is that `-l' surrounds library with `lib' and
`.a' and searches several directories.
-lobjc You need this special case of the -l option in or-
der to link an Objective C program.
-nostartfiles
Do not use the standard system startup files when
linking. The standard libraries are used normally.
-nostdlib
Don't use the standard system libraries and startup
files when linking. Only the files you specify
will be passed to the linker.
-static
On systems that support dynamic linking, this pre-
vents linking with the shared libraries. On other
systems, this option has no effect.
-shared
Produce a shared object which can then be linked
with other objects to form an executable. Only a
few systems support this option.
-symbolic
Bind references to global symbols when building a
shared object. Warn about any unresolved refer-
ences (unless overridden by the link editor option
`-Xlinker -z -Xlinker defs'). Only a few systems
support this option.
-Xlinker option
Pass option as an option to the linker. You can
use this to supply system-specific linker options
which GNU CC does not know how to recognize.
If you want to pass an option that takes an argu-
ment, you must use `-Xlinker' twice, once for the
option and once for the argument. For example, to
pass `-assert definitions', you must write `-Xlink-
er -assert -Xlinker definitions'. It does not work
to write `-Xlinker "-assert definitions"', because
this passes the entire string as a single argument,
which is not what the linker expects.
-Wl,option
Pass option as an option to the linker. If option
contains commas, it is split into multiple options
at the commas.
-u symbol
Pretend the symbol symbol is undefined, to force
linking of library modules to define it. You can
use `-u' multiple times with different symbols to
force loading of additional library modules.
BBS水木清华站∶精华区