ld.texinfo

来自「基于4个mips核的noc设计」· TEXINFO 代码 · 共 1,654 行 · 第 1/5 页

TEXINFO
1,654
字号
@item --noinhibit-execRetain the executable output file whenever it is still usable.Normally, the linker will not produce an output file if it encounterserrors during the link process; it exits without writing an output filewhen it issues any error whatsoever.@ifclear SingleFormat@kindex --oformat@item --oformat @var{output-format}@code{ld} may be configured to support more than one kind of objectfile.  If your @code{ld} is configured this way, you can use the@samp{--oformat} option to specify the binary format for the outputobject file.  Even when @code{ld} is configured to support alternativeobject formats, you don't usually need to specify this, as @code{ld}should be configured to produce as a default output format the mostusual format on each machine.  @var{output-format} is a text string, thename of a particular format supported by the BFD libraries.  (You canlist the available binary formats with @samp{objdump -i}.)  The scriptcommand @code{OUTPUT_FORMAT} can also specify the output format, butthis option overrides it.  @xref{BFD}.@end ifclear@kindex -qmagic@item -qmagicThis option is ignored for Linux compatibility.@kindex -Qy@item -QyThis option is ignored for SVR4 compatibility.@kindex --relax@cindex synthesizing linker@cindex relaxing addressing modes@item --relaxAn option with machine dependent effects.@ifset GENERICThis option is only supported on a few targets.@end ifset@ifset H8300@xref{H8/300,,@code{ld} and the H8/300}.@end ifset@ifset I960@xref{i960,, @code{ld} and the Intel 960 family}.@end ifsetOn some platforms, the @samp{--relax} option performs globaloptimizations that become possible when the linker resolves addressingin the program, such as relaxing address modes and synthesizing newinstructions in the output object file.On some platforms these link time global optimizations may make symbolicdebugging of the resulting executable impossible.@ifset GENERICThis is known to bethe case for the Matsushita MN10200 and MN10300 family of processors.@end ifset@ifset GENERICOn platforms where this is not supported, @samp{--relax} is accepted,but ignored.@end ifset@cindex retaining specified symbols@cindex stripping all but some symbols@cindex symbols, retaining selectively@item --retain-symbols-file @var{filename}Retain @emph{only} the symbols listed in the file @var{filename},discarding all others.  @var{filename} is simply a flat file, with onesymbol name per line.  This option is especially useful in environments@ifset GENERIC(such as VxWorks)@end ifsetwhere a large global symbol table is accumulated gradually, to conserverun-time memory.@samp{--retain-symbols-file} does @emph{not} discard undefined symbols,or symbols needed for relocations.You may only specify @samp{--retain-symbols-file} once in the commandline.  It overrides @samp{-s} and @samp{-S}.@ifset GENERIC@item -rpath @var{dir}@cindex runtime library search path@kindex -rpathAdd a directory to the runtime library search path.  This is used whenlinking an ELF executable with shared objects.  All @code{-rpath}arguments are concatenated and passed to the runtime linker, which usesthem to locate shared objects at runtime.  The @code{-rpath} option isalso used when locating shared objects which are needed by sharedobjects explicitly included in the link; see the description of the@code{-rpath-link} option.  If @code{-rpath} is not used when linking anELF executable, the contents of the environment variable@code{LD_RUN_PATH} will be used if it is defined.The @code{-rpath} option may also be used on SunOS.  By default, onSunOS, the linker will form a runtime search patch out of all the@code{-L} options it is given.  If a @code{-rpath} option is used, theruntime search path will be formed exclusively using the @code{-rpath}options, ignoring the @code{-L} options.  This can be useful when usinggcc, which adds many @code{-L} options which may be on NFS mountedfilesystems.For compatibility with other ELF linkers, if the @code{-R} option isfollowed by a directory name, rather than a file name, it is treated asthe @code{-rpath} option.@end ifset@ifset GENERIC@cindex link-time runtime library search path@kindex -rpath-link@item -rpath-link @var{DIR}When using ELF or SunOS, one shared library may require another.  Thishappens when an @code{ld -shared} link includes a shared library as oneof the input files.When the linker encounters such a dependency when doing a non-shared,non-relocatable link, it will automatically try to locate the requiredshared library and include it in the link, if it is not includedexplicitly.  In such a case, the @code{-rpath-link} optionspecifies the first set of directories to search.  The@code{-rpath-link} option may specify a sequence of directory nameseither by specifying a list of names separated by colons, or byappearing multiple times.This option should be used with caution as it overrides the search paththat may have been hard compiled into a shared library. In such a case itis possible to use unintentionally a different search path than theruntime linker would do.The linker uses the following search paths to locate required sharedlibraries.@enumerate@itemAny directories specified by @code{-rpath-link} options.@itemAny directories specified by @code{-rpath} options.  The differencebetween @code{-rpath} and @code{-rpath-link} is that directoriesspecified by @code{-rpath} options are included in the executable andused at runtime, whereas the @code{-rpath-link} option is only effectiveat link time. It is for the native linker only.@itemOn an ELF system, if the @code{-rpath} and @code{rpath-link} optionswere not used, search the contents of the environment variable@code{LD_RUN_PATH}. It is for the native linker only.@itemOn SunOS, if the @code{-rpath} option was not used, search anydirectories specified using @code{-L} options.@itemFor a native linker, the contents of the environment variable@code{LD_LIBRARY_PATH}.@itemFor a native ELF linker, the directories in @code{DT_RUNPATH} or@code{DT_RPATH} of a shared library are searched for sharedlibraries needed by it. The @code{DT_RPATH} entries are ignored if@code{DT_RUNPATH} entries exist.@itemThe default directories, normally @file{/lib} and @file{/usr/lib}.@itemFor a native linker on an ELF system, if the file @file{/etc/ld.so.conf}exists, the list of directories found in that file.@end enumerateIf the required shared library is not found, the linker will issue awarning and continue with the link.@end ifset@kindex -shared@kindex -Bshareable@item -shared@itemx -Bshareable@cindex shared librariesCreate a shared library.  This is currently only supported on ELF, XCOFFand SunOS platforms.  On SunOS, the linker will automatically create ashared library if the @code{-e} option is not used and there areundefined symbols in the link.@item --sort-common@kindex --sort-commonThis option tells @code{ld} to sort the common symbols by size when itplaces them in the appropriate output sections.  First come all the onebyte symbols, then all the two bytes, then all the four bytes, and theneverything else.  This is to prevent gaps between symbols due toalignment constraints.@kindex --split-by-file@item --split-by-file [@var{size}]Similar to @code{--split-by-reloc} but creates a new output section foreach input file when @var{size} is reached.  @var{size} defaults to asize of 1 if not given.@kindex --split-by-reloc@item --split-by-reloc [@var{count}]Tries to creates extra sections in the output file so that no singleoutput section in the file contains more than @var{count} relocations.This is useful when generating huge relocatable files for downloading intocertain real time kernels with the COFF object file format; since COFFcannot represent more than 65535 relocations in a single section.  Notethat this will fail to work with object file formats which do notsupport arbitrary sections.  The linker will not split up individualinput sections for redistribution, so if a single input section containsmore than @var{count} relocations one output section will contain thatmany relocations.  @var{count} defaults to a value of 32768.@kindex --stats@item --statsCompute and display statistics about the operation of the linker, suchas execution time and memory usage.@kindex --traditional-format@cindex traditional format@item --traditional-formatFor some targets, the output of @code{ld} is different in some ways fromthe output of some existing linker.  This switch requests @code{ld} touse the traditional format instead.@cindex dbxFor example, on SunOS, @code{ld} combines duplicate entries in thesymbol string table.  This can reduce the size of an output file withfull debugging information by over 30 percent.  Unfortunately, the SunOS@code{dbx} program can not read the resulting program (@code{gdb} has notrouble).  The @samp{--traditional-format} switch tells @code{ld} to notcombine duplicate entries.@kindex --section-start @var{sectionname}=@var{org}@item --section-start @var{sectionname}=@var{org}Locate a section in the output file at the absoluteaddress given by @var{org}.  You may use this option as manytimes as necessary to locate multiple sections in the commandline.@var{org} must be a single hexadecimal integer;for compatibility with other linkers, you may omit the leading@samp{0x} usually associated with hexadecimal values.  @emph{Note:} thereshould be no white space between @var{sectionname}, the equalssign (``@key{=}''), and @var{org}.@kindex -Tbss @var{org}@kindex -Tdata @var{org}@kindex -Ttext @var{org}@cindex segment origins, cmd line@item -Tbss @var{org}@itemx -Tdata @var{org}@itemx -Ttext @var{org}Use @var{org} as the starting address for---respectively---the@code{bss}, @code{data}, or the @code{text} segment of the output file.@var{org} must be a single hexadecimal integer;for compatibility with other linkers, you may omit the leading@samp{0x} usually associated with hexadecimal values.@kindex --verbose@cindex verbose@item --dll-verbose@itemx --verboseDisplay the version number for @code{ld} and list the linker emulationssupported.  Display which input files can and cannot be opened.  Displaythe linker script if using a default builtin script.@kindex --version-script=@var{version-scriptfile}@cindex version script, symbol versions@itemx --version-script=@var{version-scriptfile}Specify the name of a version script to the linker.  This is typicallyused when creating shared libraries to specify additional informationabout the version heirarchy for the library being created.  This optionis only meaningful on ELF platforms which support shared libraries.@xref{VERSION}.@kindex --warn-comon@cindex warnings, on combining symbols@cindex combining symbols, warnings on@item --warn-commonWarn when a common symbol is combined with another common symbol or witha symbol definition.  Unix linkers allow this somewhat sloppy practice,but linkers on some other operating systems do not.  This option allowsyou to find potential problems from combining global symbols.Unfortunately, some C libraries use this practice, so you may get somewarnings about symbols in the libraries as well as in your programs.There are three kinds of global symbols, illustrated here by C examples:@table @samp@item int i = 1;A definition, which goes in the initialized data section of the outputfile.@item extern int i;An undefined reference, which does not allocate space.There must be either a definition or a common symbol for thevariable somewhere.@item int i;A common symbol.  If there are only (one or more) common symbols for avariable, it goes in the uninitialized data area of the output file.The linker merges multiple common symbols for the same variable into asingle symbol.  If they are of different sizes, it picks the largestsize.  The linker turns a common symbol into a declaration, if there isa definition of the same variable.@end tableThe @samp{--warn-common} option can produce five kinds of warnings.Each warning consists of a pair of lines: the first describes the symboljust encountered, and the second describes the previous symbolencountered with the same name.  One or both of the two symbols will bea common symbol.@enumerate@itemTurning a common symbol into a reference, because there is already adefinition for the symbol.@smallexample@var{file}(@var{section}): warning: common of `@var{symbol}'   overridden by definition@var{file}(@var{section}): warning: defined here@end smallexample@itemTurning a common symbol into a reference, because a later definition forthe symbol is encountered.  This is the same as the previous case,except that the symbols are encountered in a different order.@smallexample@var{file}(@var{section}): warning: definition of `@var{symbol}'   overriding common@var{file}(@var{section}): warning: common is here@end smallexample@itemMerging a common symbol with a previous same-sized common symbol.@smallexample@var{file}(@var{section}): warning: multiple common   of `@var{symbol}'@var{file}(@var{section}): warning: previous common is here

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?