ld.1

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 1 代码 · 共 566 行 · 第 1/2 页

1
566
字号
.TH ld 1 RISC.SH Nameld, uld \- RISC link editor and ucode link editor.SH Syntax.BR ld [ .I options] [.I filename filename ...].br.BR uld [.I options] [.I filename filename ...].SH DescriptionThe .PN ldinvokes the RISC link editor, which links RISC extended.I coffobject files.  The archive format understood by.PN ldis the one created by the archiver.PN ar ..PPThe.PN ldeditor combines severalobject files into one, performs relocation, resolves externalsymbols, and supports symbol table information for symbolic debugging.In the simplest case, you specify the names of several object files asarguments to the.PN ldcommand.The .PN ldcommand combines them, producing an object module that you can executeoruse as input to a subsequent.PN ldcommand.(In the latter case, you must specify the.B \-roption to preserve the relocation entries.) The command writes its output to a file named.PN a.out .By default, this file is executable if no errors occurred during the load..PPThe.PN ldcommand concatenates object files in the order in which you specify them.The entry point of the output is thebeginning of the text segment (unless you specify the \fB\-e\fP option)..PPThe.PN uldcommand combines several ucode object files and libraries into one ucodeobject file. The command hides external symbols for better optimizations bysubsequent compiler passes.  The.PN uldcommand uses the symbol tables of.I coffobject files loaded with ucode object files to determine whatexternal symbols not to hide. You can specify that the.PN uldcommand not hide external symbols by creating a file that describes thosesymbols.  .PPThe link editors.PN ldand.PN uldaccept object files targeted for either Big Endian or Little Endian byte ordering with their headers andsymbolic tables in any byte ordering.  However .PN ldand.PN uldare faster if the headers and symbolic tables have the byte ordering of themachine that they are running on.  The default byte ordering of the headersand symbolic tables is the target byte ordering of the output object file.For nonrelocatable object files, the default byte ordering of the headersand symbolic tables cannot be changed..PPIf you specify that you want to link a library, the.PN ldand .PN uldcommands search the library exactly onceat the point it is encountered in the argument list.The library (archive) symbol table (see.MS ar 1 )is a hash table that.PN ldand.PN uld search to resolve external references. The commands load only those routines that define unresolved externalreferences. The order of the routines in the library isunimportant..PPBy default, the.PN ldand .PN uldcommands search for libraries in the.PN /lib , .PN /usr/lib, and .PN /usr/local/lib directories.  In some cases, the target byte ordering of the object files.PN ldor .PN uldis loading is the opposite of the byte ordering of the machine on whichthe link editor is executing. When this case occurs, the link editorchanges the default directories it searches for libraries. If the objectfile's byte ordering is Big Endian and the machine's byte ordering isLittle Endian (Digital products), the link editor searches the.PN /libeb ,.PN /usr/libeb ,and.PN /usr/local/libebdirectories, by default. Conversely, if the object file's byte orderingis Little Endian and the machine's byte ordering is Big Endian, theeditor searches the.PN /libel ,.PN /usr/libel ,and.PN /usr/local/libeldirectories, by default..PPThe following symbols are reserved; do not define them:etext, edata, end, _ftext, _fdata, _fbss, _gp,\_procedure_table,\_procedure_table_size, and\_procedure_string_table.These loader defined symbols, if referred to, have their values set asdescribed in .MS end 3 ..SH OptionsYou can use the following options on both the.PN ldand.PN uld command lines.If you specify an option that the command does not use, the commandignores that option..PPYou can specify the options described in this section on the.PN cccommand line. To do so, prepend a .B kto the option. When you prepend a .B k ,the.PN cccommand ignores the option and passes it to the link editor. The linkeditor ignores the prepended.B kand processes the option normally. Therefore, the .B \-kAoption has the same effect as specifying.B \-A ..TP 15.BI \-A " file"Link to allow incremental loading.  The link editor performs the linkprocess so that the resulting object can be read into an already executing program..IPThe .I fileargumentis the name of an object file. The link editor defines additional symbols usingthe symbol table in that file. This argument must appear on the commandline before any other object file..IPDuring an incremental load, the link editor loads only newly linked material into the text anddata portions of .BR a.out .However, the new symbol table reflectsevery symbol defined before and after the incremental load..IPYou can use the .B \-Toption to cause the link editor to assumethat thenewly linked segment starts at the specified address,which must be a correct multiple for the resulting object type.The default resulting object type is an OMAGIC file. The defaultstarting address of the text is the value of the end symbol rounded toSCNROUND as defined in the include file.PN <scnhdr.h>.By default, when the newly linked segment is read into an already executing programthe initial value of the break must also be rounded..IPAll objects except the argument to the.B \-Aoption must be compiled with the.BI \-G " 0"option. Using the .B \-Aoption sets .BI \-G " 0"for linking..IPFor jump instructions to operate correctly, the beginning and endingpoints of the instruction must be in the same 256 megabyte segment. Thus, it is invalid to use thedefault address of a ZMAGIC file as the base file and allow the newly linked text tostart at the value of the end symbol..IPTo solve this problem,use the.B \-Doption when you create the base file.  Using this option ensures thatthe text and data will be in the same 256 megabyte segment.Alternatively, use the.B \-Noption, which places the data section immediately following the textsection..TP 15.BI \-B " num"Set the bss segment origin.  The argument.I numis a hexadecimal address.You can use this option only if the final object is an OMAGIC file..TP 15.BI \-B stringAppend.I stringto the library name created for the.BI \-l xor.BI \-kl xoptions. When searching for a library, the link editor first appends.I stringto the library name. If the link editor cannot find a library of thatname, it searches for the library name without .I string..TP 15.B \-bDo not merge the symbolic information entries for the same file into one entryfor that file.  Use this option when the symbolic informationfrom the same file appears differently in any of the objects to be linked.  Thissituation can occur when object files are compiled, by means of conditional compilation, with an apparently different version of an include file..TP 15.B \-bestGnumCalculate the best number to use as an argument to the.B \-G option. Use this option when you are compiling and linking the files that will produce the objects you wantto link with.BR \-G .Using too large a number with the.B \-G option may cause the global pointer data area to overflow; using too small a number mayreduce your program's execution speed..TP 15.B \-count .ns.TP 15.B \-countall.ns.TP 15.B \-nocount Count (or do not count) the specified objects as able to be recompiled whencalculating the best number to use as an argument to the.B \-Goption.By default, the.B \-bestGnumoption assumes you can recompile everything with the .B \-G option. If you cannot recompile certain object files or libraries(because, for example, you have no sources for them), use theseoptions to tell the link editor to take this into account in calculating

⌨️ 快捷键说明

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