Provided by:
manpages-zh_1.5.2-1_all 
NAME
ld - GNU linker ()
(SYNOPSIS)
ld [-o output] objfile...
[-Aarchitecture] [-b input-format] [-Bstatic] [-Bdynamic]
[-Bsymbolic] [-c commandfile] [--cref] [-d|-dc|-dp]
[-defsym symbol = expression] [--demangle] [--no-demangle]
[-e entry] [-embedded-relocs] [-E] [-export-dynamic] [-f name]
[--auxiliary name] [-F name] [--filter name] [-format input-
format] [-g] [-G size] [-h name] [-soname name] [--help] [-i]
[-lar] [-Lsearchdir] [-M] [-Map mapfile] [-m emulation] [-n|-N]
[-noinhibit-exec] [-no-keep-memory] [-no-warn-mismatch]
[-Olevel] [-oformat output-format] [-R filename] [-relax]
[-r|-Ur] [-rpath directory] [-rpath-link directory] [-S] [-s]
[-shared] [-sort-common] [-split-by-reloc count]
[-split-by-file] [-T commandfile] [-Ttext textorg]
[-Tdata dataorg] [-Tbss bssorg] [-t] [-u sym] [-V] [-v]
[--verbose] [--version] [-warn-common] [-warn-constructors]
[-warn-multiple-gp] [-warn-once] [-warn-section-align]
[--whole-archive] [--no-whole-archive] [--wrap symbol] [-X] [-x]
(DESCRIPTION)
ld (object) (archive), , (symbol reference). , ld.
ld (Linker Command Language) , . ; `info' `ld' , ld:
the GNU linker , GNU linker .
ld BFD , ld , -- COFF a.out, , . `objdump -i'
; objdump(1).
GNU linker , linker . linker ; ld , (, , ).
GNU linker ld , linker. , ld .
(OPTIONS)
, , . , , Unix , ld Unix . hello.o:
$ ld -o output /lib/crt0.o hello.o -lc
ld output , /lib/crt0.o hello.o libc.a ( ).
ld , . , , ld , . ( )
-- -- -A, -b ( -format), -defsym, -L, -l, -R, -u.
, objfile, , , ; objfile .
linker , -l, -R , . , linker , `No input files'.
, , .
-Aarchitecture
ld , Intel 960 . ld , architecture 960 , ; ,
. linker , , .
, ld `-ACA' `-ltry', linker ( -L )
try
libtry.a
tryca
libtryca.a
; `-ACA'.
ld .
-A , , ld -l , .
-b input-format
, , . , ld . input-format , BFD .
-format input-format , TARGET .
. -b ( ), , -b input-format .
GNUTARGET . TARGET .
-Bstatic
. .
-Bdynamic
. , .
-Bsymbolic
, , (bind reference) (definition). , . ELF .
-c commandfile
ld commandfile . ld ( ); commandfile .
, `{' `}' .
--cref (cross reference). (linker map) , , .
-d
-dc
-dp , linker . ld (-r), (common symbol) .
FORCE_COMMON_ALLOCATION .
-defsym symbol = expression
, expression . . expression : , . + -
. , .
--demangle
--no-demangle
, (demangle) . demangle , linker : ( ); C++
(symbol name) . linker , COLLECT_NO_DEMANGLE . .
-e entry
entry () , . `info' ld' .
-embedded-relocs
MIPS PIC , GNU -membedded-pic . linker , , .
testsuite/ld-empic .
-E
-export-dynamic
ELF , . , (dynamic object) . dlopen .
-f name
--auxiliary name
ELF , DT_AUXILIARY name. linker, name .
-F name
--filter name
ELF , DT_FILTER name. linker, name .
-format input-format
-b input-format.
-g ; .
-G size
GP () size . MIPS ECOFF, .
-h name
-soname name
ELF , DT_SONAME name. DT_SONAME , , linker
DT_SONAME , linker .
--help , . --version , , GNU . linker.
-i (incremental link), -r .
-lar ar. . ar , ld libar.a .
-Lsearchdir
searchdir , ld . .
( -L ) ld (emulation) . , SEARCH_DIR .
-M -- ld , .
-Map mapfile
mapfile -- ld , .
-m emulation
emulation . --verbose -V . .
-N (section). Unix (magic number), OMAGIC.
`-N' , linker (page-align).
-n , , NMAGIC .
-noinhibit-exec
, , linker . , , .
-no-keep-memory
linker , , . linker , . , linker , .
-no-warn-mismatch
, , , , (endianness), linker . linker . ,
, linker .
-o output
output ld ; , `a.out'. OUTPUT .
-Olevel
. , . level . .
-oformat output-format
. , ld . output-format , BFD . OUTPUT_FORMAT
, .
-R filename
filename , , . .
-relax , H8/300.
, linker , (relax) (synthesize) .
`-relax' , .
-r -- , ld , (partial) . , Unix (magic number) ,
OMAGIC. , linker . C++ , (constructor)
(reference); -Ur .
-i .
-rpath directory
(runtime) . ELF . -rpath , linker, linker
. -rpath ; -rpath-link . ELF -rpath , linker
LD_RUN_PATH -- .
-rpath SunOS , , linker -L . -rpath , -rpath , -L .
gcc, NFS , gcc -L .
-rpath-link directory
ELF SunOS , . ld -shared , .
linker , , , linker , , . , -rpath-link
. -rpath-link , . , .
, linker , .
-S ( ).
-s .
-shared
. ELF SunOS ( SunOS , , -e , , linker ).
-sort-common
ld , . , , , . . .
-split-by-reloc count
(extra section), , count . COFF , ; COFF
65535 . , , . , linker , , count , .
-split-by-file
-split-by-reloc , .
-Tbss org
-Tdata org
-Ttext org
org -- -- bss, data, text . org .
-T commandfile
-c commandfile; .
-t ld .
-u sym sym (undefined) . , , linker . -u .
-Ur C++ , -r: -- , ld . C++ , -Ur (constructor)
(reference), -r .
--verbose
ld , (emulation). , ,
-v, -V ld . -V .
--version
ld .
-warn-common
, , linker . Unix linker , . .
-warn-constructors
(global constructor), linker . , COFF ELF, linker
.
-warn-multiple-gp
, linker . , Alpha.
-warn-once
, .
-warn-section-align
(section) , linker . , ; , SECTIONS .
--whole-archive
--whole-archive , , . , .
--no-whole-archive
--whole-archive .
--wrap symbol
symbol (wrapper function). symbol (undefined reference)
__wrap_symbol. __real_symbol symbol.
-X . , `L' .
-x .
(ENVIRONMENT)
GNUTARGET ld .
-b ( -format), GNUTARGET , BFD . GNUTARGET , ld .
GNUTARGET default, BFD ; , , . , BFD , , .
(SEE ALSO)
objdump(1)
`ld' `binutils' ( info)
ld: the GNU linker, Steve Chamberlain and Roland Pesch; The GNU Binary
Utilities, Roland H. Pesch.
COPYING
Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software
Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in the
original English.
[]
<xuming@users.sourceforge.net>
[]
2003/05/13
Linuxman
http://cmpp.linuxforum.net