ld.texinfo
来自「基于4个mips核的noc设计」· TEXINFO 代码 · 共 1,654 行 · 第 1/5 页
TEXINFO
1,654 行
@kindex --script=@var{script}@cindex script files@item -T @var{scriptfile}@itemx --script=@var{scriptfile}Use @var{scriptfile} as the linker script. This script replaces@code{ld}'s default linker script (rather than adding to it), so@var{commandfile} must specify everything necessary to describe theoutput file. You must use this option if you want to use a commandwhich can only appear once in a linker script, such as the@code{SECTIONS} or @code{MEMORY} command. @xref{Scripts}. If@var{scriptfile} does not exist in the current directory, @code{ld}looks for it in the directories specified by any preceding @samp{-L}options. Multiple @samp{-T} options accumulate.@kindex -u @var{symbol}@kindex --undefined=@var{symbol}@cindex undefined symbol@item -u @var{symbol}@itemx --undefined=@var{symbol}Force @var{symbol} to be entered in the output file as an undefinedsymbol. Doing this may, for example, trigger linking of additionalmodules from standard libraries. @samp{-u} may be repeated withdifferent option arguments to enter additional undefined symbols. Thisoption is equivalent to the @code{EXTERN} linker script command.@kindex -Ur@cindex constructors@item -UrFor anything other than C++ programs, this option is equivalent to@samp{-r}: it generates relocatable output---i.e., an output file that can inturn serve as input to @code{ld}. When linking C++ programs, @samp{-Ur}@emph{does} resolve references to constructors, unlike @samp{-r}.It does not work to use @samp{-Ur} on files that were themselves linkedwith @samp{-Ur}; once the constructor table has been built, it cannotbe added to. Use @samp{-Ur} only for the last partial link, and@samp{-r} for the others.@kindex --unique[=@var{SECTION}]@item --unique[=@var{SECTION}]Creates a separate output section for every input section matching@var{SECTION}, or if the optional wildcard @var{SECTION} argument ismissing, for every orphan input section. An orphan section is one notspecifically mentioned in a linker script. You may use this optionmultiple times on the command line; It prevents the normal merging ofinput sections with the same name, overriding output section assignmentsin a linker script.@kindex -v@kindex -V@kindex --version@cindex version@item -v@itemx --version@itemx -VDisplay the version number for @code{ld}. The @code{-V} option alsolists the supported emulations.@kindex -x@kindex --discard-all@cindex deleting local symbols@item -x@itemx --discard-allDelete all local symbols.@kindex -X@kindex --discard-locals@cindex local symbols, deleting@cindex L, deleting symbols beginning@item -X@itemx --discard-localsDelete all temporary local symbols. For most targets, this is all localsymbols whose names begin with @samp{L}.@kindex -y @var{symbol}@kindex --trace-symbol=@var{symbol}@cindex symbol tracing@item -y @var{symbol}@itemx --trace-symbol=@var{symbol}Print the name of each linked file in which @var{symbol} appears. Thisoption may be given any number of times. On many systems it is necessaryto prepend an underscore.This option is useful when you have an undefined symbol in your link butdon't know where the reference is coming from.@kindex -Y @var{path}@item -Y @var{path}Add @var{path} to the default library search path. This option existsfor Solaris compatibility.@kindex -z @var{keyword}@item -z @var{keyword}The recognized keywords are @code{initfirst}, @code{interpose},@code{loadfltr}, @code{nodefaultlib}, @code{nodelete}, @code{nodlopen},@code{nodump}, @code{now} and @code{origin}. The other keywords areignored for Solaris compatibility. @code{initfirst} marks the objectto be initialized first at runtime before any other objects.@code{interpose} marks the object that its symbol table interposesbefore all symbols but the primary executable. @code{loadfltr} marksthe object that its filtees be processed immediately at runtime.@code{nodefaultlib} marks the object that the search for dependenciesof this object will ignore any default library search paths.@code{nodelete} marks the object shouldn't be unloaded at runtime.@code{nodlopen} marks the object not available to @code{dlopen}.@code{nodump} marks the object can not be dumped by @code{dldump}.@code{now} marks the object with the non-lazy runtime binding.@code{origin} marks the object may contain $ORIGIN.@code{defs} disallows undefined symbols.@kindex -(@cindex groups of archives@item -( @var{archives} -)@itemx --start-group @var{archives} --end-groupThe @var{archives} should be a list of archive files. They may beeither explicit file names, or @samp{-l} options.The specified archives are searched repeatedly until no new undefinedreferences are created. Normally, an archive is searched only once inthe order that it is specified on the command line. If a symbol in thatarchive is needed to resolve an undefined symbol referred to by anobject in an archive that appears later on the command line, the linkerwould not be able to resolve that reference. By grouping the archives,they all be searched repeatedly until all possible references areresolved.Using this option has a significant performance cost. It is best to useit only when there are unavoidable circular references between two ormore archives.@kindex -assert @var{keyword}@item -assert @var{keyword}This option is ignored for SunOS compatibility.@kindex -Bdynamic@kindex -dy@kindex -call_shared@item -Bdynamic@itemx -dy@itemx -call_sharedLink against dynamic libraries. This is only meaningful on platformsfor which shared libraries are supported. This option is normally thedefault on such platforms. The different variants of this option arefor compatibility with various systems. You may use this optionmultiple times on the command line: it affects library searching for@code{-l} options which follow it.@kindex -Bgroup@item -BgroupSet the @code{DF_1_GROUP} flag in the @code{DT_FLAGS_1} entry in the dynamicsection. This causes the runtime linker to handle lookups in thisobject and its dependencies to be performed only inside the group.@code{--no-undefined} is implied. This option is only meaningful on ELFplatforms which support shared libraries.@kindex -Bstatic@kindex -dn@kindex -non_shared@kindex -static@item -Bstatic@itemx -dn@itemx -non_shared@itemx -staticDo not link against shared libraries. This is only meaningful onplatforms for which shared libraries are supported. The differentvariants of this option are for compatibility with various systems. Youmay use this option multiple times on the command line: it affectslibrary searching for @code{-l} options which follow it.@kindex -Bsymbolic@item -BsymbolicWhen creating a shared library, bind references to global symbols to thedefinition within the shared library, if any. Normally, it is possiblefor a program linked against a shared library to override the definitionwithin the shared library. This option is only meaningful on ELFplatforms which support shared libraries.@kindex --check-sections@kindex --no-check-sections@item --check-sections@itemx --no-check-sectionsAsks the linker @emph{not} to check section addresses after they havebeen assigned to see if there any overlaps. Normally the linker willperform this check, and if it finds any overlaps it will producesuitable error messages. The linker does know about, and does makeallowances for sections in overlays. The default behaviour can berestored by using the command line switch @samp{--check-sections}.@cindex cross reference table@kindex --cref@item --crefOutput a cross reference table. If a linker map file is beinggenerated, the cross reference table is printed to the map file.Otherwise, it is printed on the standard output.The format of the table is intentionally simple, so that it may beeasily processed by a script if necessary. The symbols are printed out,sorted by name. For each symbol, a list of file names is given. If thesymbol is defined, the first file listed is the location of thedefinition. The remaining files contain references to the symbol.@cindex symbols, from command line@kindex --defsym @var{symbol}=@var{exp}@item --defsym @var{symbol}=@var{expression}Create a global symbol in the output file, containing the absoluteaddress given by @var{expression}. You may use this option as manytimes as necessary to define multiple symbols in the command line. Alimited form of arithmetic is supported for the @var{expression} in thiscontext: you may give a hexadecimal constant or the name of an existingsymbol, or use @code{+} and @code{-} to add or subtract hexadecimalconstants or symbols. If you need more elaborate expressions, considerusing the linker command language from a script (@pxref{Assignments,,Assignment: Symbol Definitions}). @emph{Note:} there should be no whitespace between @var{symbol}, the equals sign (``@key{=}''), and@var{expression}.@cindex demangling, from command line@kindex --demangle[=@var{style}]@kindex --no-demangle@item --demangle[=@var{style}]@itemx --no-demangleThese options control whether to demangle symbol names in error messagesand other output. When the linker is told to demangle, it tries topresent symbol names in a readable fashion: it strips leadingunderscores if they are used by the object file format, and converts C++mangled symbol names into user readable names. Different compilers havedifferent mangling styles. The optional demangling style argument can be usedto choose an appropriate demangling style for your compiler. The linker willdemangle by default unless the environment variable @samp{COLLECT_NO_DEMANGLE}is set. These options may be used to override the default.@cindex dynamic linker, from command line@kindex --dynamic-linker @var{file}@item --dynamic-linker @var{file}Set the name of the dynamic linker. This is only meaningful whengenerating dynamically linked ELF executables. The default dynamiclinker is normally correct; don't use this unless you know what you aredoing.@cindex MIPS embedded PIC code@kindex --embedded-relocs@item --embedded-relocsThis option is only meaningful when linking MIPS embedded PIC code,generated by the -membedded-pic option to the @sc{gnu} compiler andassembler. It causes the linker to create a table which may be used atruntime to relocate any data which was statically initialized to pointervalues. See the code in testsuite/ld-empic for details.@kindex --force-exe-suffix@item --force-exe-suffixMake sure that an output file has a .exe suffix.If a successfully built fully linked output file does not have a@code{.exe} or @code{.dll} suffix, this option forces the linker to copythe output file to one of the same name with a @code{.exe} suffix. Thisoption is useful when using unmodified Unix makefiles on a MicrosoftWindows host, since some versions of Windows won't run an image unlessit ends in a @code{.exe} suffix.@kindex --gc-sections@kindex --no-gc-sections@cindex garbage collection@item --no-gc-sections@itemx --gc-sectionsEnable garbage collection of unused input sections. It is ignored ontargets that do not support this option. This option is not compatiblewith @samp{-r}, nor should it be used with dynamic linking. The defaultbehaviour (of not performing this garbage collection) can be restored byspecifying @samp{--no-gc-sections} on the command line.@cindex help@cindex usage@kindex --help@item --helpPrint a summary of the command-line options on the standard output and exit.@kindex --target-help@item --target-helpPrint a summary of all target specific options on the standard output and exit.@kindex -Map@item -Map @var{mapfile}Print a link map to the file @var{mapfile}. See the description of the@samp{-M} option, above.@cindex memory usage@kindex --no-keep-memory@item --no-keep-memory@code{ld} normally optimizes for speed over memory usage by caching thesymbol tables of input files in memory. This option tells @code{ld} toinstead optimize for memory usage, by rereading the symbol tables asnecessary. This may be required if @code{ld} runs out of memory spacewhile linking a large executable.@kindex --no-undefined@kindex -z defs@item --no-undefined@itemx -z defsNormally when creating a non-symbolic shared library, undefined symbolsare allowed and left to be resolved by the runtime loader. These optionsdisallow such undefined symbols.@kindex --allow-shlib-undefined@item --allow-shlib-undefinedAllow undefined symbols in shared objects even when --no-undefined isset. The net result will be that undefined symbols in regular objectswill still trigger an error, but undefined symbols in shared objectswill be ignored. The implementation of no_undefined makes theassumption that the runtime linker will choke on undefined symbols.However there is at least one system (BeOS) where undefined symbols inshared libraries is normal since the kernel patches them at load time toselect which function is most appropriate for the current architecture.I.E. dynamically select an appropriate memset function. Apparently itis also normal for HPPA shared libraries to have undefined symbols.@kindex --no-warn-mismatch@item --no-warn-mismatchNormally @code{ld} will give an error if you try to link together inputfiles that are mismatched for some reason, perhaps because they havebeen compiled for different processors or for different endiannesses.This option tells @code{ld} that it should silently permit such possibleerrors. This option should only be used with care, in cases when youhave taken some special action that ensures that the linker errors areinappropriate.@kindex --no-whole-archive@item --no-whole-archiveTurn off the effect of the @code{--whole-archive} option for subsequentarchive files.@cindex output file after errors@kindex --noinhibit-exec
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?