ld.texinfo

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

TEXINFO
1,654
字号
@item -d@itemx -dc@itemx -dpThese three options are equivalent; multiple forms are supported forcompatibility with other linkers.  They assign space to common symbolseven if a relocatable output file is specified (with @samp{-r}).  Thescript command @code{FORCE_COMMON_ALLOCATION} has the same effect.@xref{Miscellaneous Commands}.@cindex entry point, from command line@kindex -e @var{entry}@kindex --entry=@var{entry}@item -e @var{entry}@itemx --entry=@var{entry}Use @var{entry} as the explicit symbol for beginning execution of yourprogram, rather than the default entry point.  If there is no symbolnamed @var{entry}, the linker will try to parse @var{entry} as a number,and use that as the entry address (the number will be interpreted inbase 10; you may use a leading @samp{0x} for base 16, or a leading@samp{0} for base 8).  @xref{Entry Point}, for a discussion of defaultsand other ways of specifying the entry point.@cindex dynamic symbol table@kindex -E@kindex --export-dynamic@item -E@itemx --export-dynamicWhen creating a dynamically linked executable, add all symbols to thedynamic symbol table.  The dynamic symbol table is the set of symbolswhich are visible from dynamic objects at run time.If you do not use this option, the dynamic symbol table will normallycontain only those symbols which are referenced by some dynamic objectmentioned in the link.If you use @code{dlopen} to load a dynamic object which needs to referback to the symbols defined by the program, rather than some otherdynamic object, then you will probably need to use this option whenlinking the program itself.@cindex big-endian objects@cindex endianness@kindex -EB@item -EBLink big-endian objects.  This affects the default output format.@cindex little-endian objects@kindex -EL@item -ELLink little-endian objects.  This affects the default output format.@kindex -f@kindex --auxiliary@item -f@itemx --auxiliary @var{name}When creating an ELF shared object, set the internal DT_AUXILIARY fieldto the specified name.  This tells the dynamic linker that the symboltable of the shared object should be used as an auxiliary filter on thesymbol table of the shared object @var{name}.If you later link a program against this filter object, then, when yourun the program, the dynamic linker will see the DT_AUXILIARY field.  Ifthe dynamic linker resolves any symbols from the filter object, it willfirst check whether there is a definition in the shared object@var{name}.  If there is one, it will be used instead of the definitionin the filter object.  The shared object @var{name} need not exist.Thus the shared object @var{name} may be used to provide an alternativeimplementation of certain functions, perhaps for debugging or formachine specific performance.This option may be specified more than once.  The DT_AUXILIARY entrieswill be created in the order in which they appear on the command line.@kindex -F@kindex --filter@item -F @var{name}@itemx --filter @var{name}When creating an ELF shared object, set the internal DT_FILTER field tothe specified name.  This tells the dynamic linker that the symbol tableof the shared object which is being created should be used as a filteron the symbol table of the shared object @var{name}.If you later link a program against this filter object, then, when yourun the program, the dynamic linker will see the DT_FILTER field.  Thedynamic linker will resolve symbols according to the symbol table of thefilter object as usual, but it will actually link to the definitionsfound in the shared object @var{name}.  Thus the filter object can beused to select a subset of the symbols provided by the object@var{name}.Some older linkers used the @code{-F} option throughout a compilationtoolchain for specifying object-file format for both input and outputobject files.  The @sc{gnu} linker uses other mechanisms for thispurpose: the @code{-b}, @code{--format}, @code{--oformat} options, the@code{TARGET} command in linker scripts, and the @code{GNUTARGET}environment variable.  The @sc{gnu} linker will ignore the @code{-F}option when not creating an ELF shared object.@cindex finalization function@kindex -fini@item -fini @var{name}When creating an ELF executable or shared object, call NAME when theexecutable or shared object is unloaded, by setting DT_FINI to theaddress of the function.  By default, the linker uses @code{_fini} asthe function to call.@kindex -g@item -gIgnored.  Provided for compatibility with other tools.@kindex -G@kindex --gpsize@cindex object size@item -G@var{value}@itemx --gpsize=@var{value}Set the maximum size of objects to be optimized using the GP register to@var{size}.  This is only meaningful for object file formats such asMIPS ECOFF which supports putting large and small objects into differentsections.  This is ignored for other object file formats.@cindex runtime library name@kindex -h@var{name}@kindex -soname=@var{name}@item -h@var{name}@itemx -soname=@var{name}When creating an ELF shared object, set the internal DT_SONAME field tothe specified name.  When an executable is linked with a shared objectwhich has a DT_SONAME field, then when the executable is run the dynamiclinker will attempt to load the shared object specified by the DT_SONAMEfield rather than the using the file name given to the linker.@kindex -i@cindex incremental link@item -iPerform an incremental link (same as option @samp{-r}).@cindex initialization function@kindex -init@item -init @var{name}When creating an ELF executable or shared object, call NAME when theexecutable or shared object is loaded, by setting DT_INIT to the addressof the function.  By default, the linker uses @code{_init} as thefunction to call.@cindex archive files, from cmd line@kindex -l@var{archive}@kindex --library=@var{archive}@item -l@var{archive}@itemx --library=@var{archive}Add archive file @var{archive} to the list of files to link.  Thisoption may be used any number of times.  @code{ld} will search itspath-list for occurrences of @code{lib@var{archive}.a} for every@var{archive} specified.On systems which support shared libraries, @code{ld} may also search forlibraries with extensions other than @code{.a}.  Specifically, on ELFand SunOS systems, @code{ld} will search a directory for a library withan extension of @code{.so} before searching for one with an extension of@code{.a}.  By convention, a @code{.so} extension indicates a sharedlibrary.The linker will search an archive only once, at the location where it isspecified on the command line.  If the archive defines a symbol whichwas undefined in some object which appeared before the archive on thecommand line, the linker will include the appropriate file(s) from thearchive.  However, an undefined symbol in an object appearing later onthe command line will not cause the linker to search the archive again.See the @code{-(} option for a way to force the linker to searcharchives multiple times.You may list the same archive multiple times on the command line.@ifset GENERICThis type of archive searching is standard for Unix linkers.  However,if you are using @code{ld} on AIX, note that it is different from thebehaviour of the AIX linker.@end ifset@cindex search directory, from cmd line@kindex -L@var{dir}@kindex --library-path=@var{dir}@item -L@var{searchdir}@itemx --library-path=@var{searchdir}Add path @var{searchdir} to the list of paths that @code{ld} will searchfor archive libraries and @code{ld} control scripts.  You may use thisoption any number of times.  The directories are searched in the orderin which they are specified on the command line.  Directories specifiedon the command line are searched before the default directories.  All@code{-L} options apply to all @code{-l} options, regardless of theorder in which the options appear.@ifset UsesEnvVarsThe default set of paths searched (without being specified with@samp{-L}) depends on which emulation mode @code{ld} is using, and insome cases also on how it was configured.  @xref{Environment}.@end ifsetThe paths can also be specified in a link script with the@code{SEARCH_DIR} command.  Directories specified this way are searchedat the point in which the linker script appears in the command line.@cindex emulation@kindex -m @var{emulation}@item -m@var{emulation}Emulate the @var{emulation} linker.  You can list the availableemulations with the @samp{--verbose} or @samp{-V} options.If the @samp{-m} option is not used, the emulation is taken from the@code{LDEMULATION} environment variable, if that is defined.Otherwise, the default emulation depends upon how the linker wasconfigured.@cindex link map@kindex -M@kindex --print-map@item -M@itemx --print-mapPrint a link map to the standard output.  A link map providesinformation about the link, including the following:@itemize @bullet@itemWhere object files and symbols are mapped into memory.@itemHow common symbols are allocated.@itemAll archive members included in the link, with a mention of the symbolwhich caused the archive member to be brought in.@end itemize@kindex -n@cindex read-only text@cindex NMAGIC@kindex --nmagic@item -n@itemx --nmagicTurn off page alignment of sections, and mark the output as@code{NMAGIC} if possible.@kindex -N@kindex --omagic@cindex read/write from cmd line@cindex OMAGIC@item -N@itemx --omagicSet the text and data sections to be readable and writable.  Also, donot page-align the data segment.  If the output format supports Unixstyle magic numbers, mark the output as @code{OMAGIC}.@kindex -o @var{output}@kindex --output=@var{output}@cindex naming the output file@item -o @var{output}@itemx --output=@var{output}Use @var{output} as the name for the program produced by @code{ld}; if thisoption is not specified, the name @file{a.out} is used by default.  Thescript command @code{OUTPUT} can also specify the output file name.@kindex -O @var{level}@cindex generating optimized output@item -O @var{level}If @var{level} is a numeric values greater than zero @code{ld} optimizesthe output.  This might take significantly longer and therefore probablyshould only be enabled for the final binary.@kindex -q@kindex --emit-relocs@cindex retain relocations in final executable@item -q@itemx --emit-relocsLeave relocation sections and contents in fully linked exececutables.Post link analysis and optimization tools may need this information inorder to perform correct modifications of executables.  This resultsin larger executables.@cindex partial link@cindex relocatable output@kindex -r@kindex --relocateable@item -r@itemx --relocateableGenerate relocatable output---i.e., generate an output file that can inturn serve as input to @code{ld}.  This is often called @dfn{partiallinking}.  As a side effect, in environments that support standard Unixmagic numbers, this option also sets the output file's magic number to@code{OMAGIC}.@c ; see @code{-N}.If this option is not specified, an absolute file is produced.  Whenlinking C++ programs, this option @emph{will not} resolve references toconstructors; to do that, use @samp{-Ur}.This option does the same thing as @samp{-i}.@kindex -R @var{file}@kindex --just-symbols=@var{file}@cindex symbol-only input@item -R @var{filename}@itemx --just-symbols=@var{filename}Read symbol names and their addresses from @var{filename}, but do notrelocate it or include it in the output.  This allows your output fileto refer symbolically to absolute locations of memory defined in otherprograms.  You may use this option more than once.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.@kindex -s@kindex --strip-all@cindex strip all symbols@item -s@itemx --strip-allOmit all symbol information from the output file.@kindex -S@kindex --strip-debug@cindex strip debugger symbols@item -S@itemx --strip-debugOmit debugger symbol information (but not all symbols) from the output file.@kindex -t@kindex --trace@cindex input files, displaying@item -t@itemx --tracePrint the names of the input files as @code{ld} processes them.@kindex -T @var{script}

⌨️ 快捷键说明

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