⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ld.1

📁 早期freebsd实现
💻 1
📖 第 1 页 / 共 2 页
字号:
.\" This source code is a product of Sun Microsystems, Inc. and is provided.\" for unrestricted use provided that this legend is included on all tape.\" media and as a part of the software program in whole or part.  Users.\" may copy or modify this source code without charge, but are not authorized.\" to license or distribute it to anyone else except as part of a product or.\" program developed by the user..\".\" THIS PROGRAM CONTAINS SOURCE CODE COPYRIGHTED BY SUN MICROSYSTEMS, INC..\" SUN MICROSYSTEMS, INC., MAKES NO REPRESENTATIONS ABOUT THE SUITABLITY.\" OF SUCH SOURCE CODE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT.\" EXPRESS OR IMPLIED WARRANTY OF ANY KIND.  SUN MICROSYSTEMS, INC. DISCLAIMS.\" ALL WARRANTIES WITH REGARD TO SUCH SOURCE CODE, INCLUDING ALL IMPLIED.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN.\" NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT,.\" INCIDENTAL, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING.\" FROM USE OF SUCH SOURCE CODE, REGARDLESS OF THE THEORY OF LIABILITY..\" .\" This source code is provided with no support and without any obligation on.\" the part of Sun Microsystems, Inc. to assist in its use, correction, .\" modification or enhancement..\".\" SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE.\" INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS.\" SOURCE CODE OR ANY PART THEREOF..\".\" Sun Microsystems, Inc..\" 2550 Garcia Avenue.\" Mountain View, California 94043.\".\" Copyright (c) 1991 Sun Microsystems, Inc..\".\" @(#)ld.1 1.48 90/02/02 SMI;  .TH LD 1 "21 January 1990".SH NAMEld, ld.so \- link editor, dynamic link editor.SH SYNOPSIS.B ld[.BI \-align " datum"] [.BI \-assert " assertion-keyword"].if n .ti +0.5i[.BI \-A " name"] [.BI \-B "binding-keyword"] [.B \-d] .if t .ti +0.5i[.B \-dc].if n .ti +0.5i[.B \-dp] [.BI \-D " hex"] [.BI \-e " entry"] [.BI \-l x] [.BI \-L dir].if n .ti +0.5i[.B \-M] [.B \-n] [.B \-N] [.BI \-o " name"] [.B \-p].if t .ti +0.5i[.B \-r] [.B \-s] [.B \-S].if n .ti +0.5i[.B \-t] [.BR \-T \|[\| text \|].I hex] [.BI \-Tdata " hex"] [.BI \-u " name"].if n .ti +0.5i[.B \-x] [.B \-X] [.BI \-y sym] .if t .ti +0.5i[.B \-z] .I filename\&.\|.\|..SH DESCRIPTION.IX  "ld command"  ""  "\fLld\fP \(em link editor".IX  "programming tools"  "ld command"  ""  "\fLld\fP \(em link editor".IX  "link editor"  ""  "link editor \(em \fLld\fP".LP.B ldcombines object programs to create an.I executablefile or another object program suitable for further.B ldprocessing(with the .B \-roption).  The object modules on which .B ldoperates are specified on the command line, and can be:.RS.TP 3\(busimple object files, which typically end in the.BR .o suffix, and are referred to as \*(lqdot-oh\*(rq files.TP 3\(bu.BR ar (1V)library archives.RB ( .a ),or \*(lqlibraries\*(rq.TP 3\(budynamically-bound, sharable object files .RB ( .so ),are also referred to as \*(lqshared libraries,\*(rqwhich are created from previous.B ldexecutions..RE.LPUnless an output file is specified,.B ldproduces a file named.BR a.out .This file contains the object files given as input,appropriately combined to form an executable file..SH OPTIONSWhen linking debugging or profiling objects, include the.B \-gor.B \-pgoption (see.BR cc (1V)),as appropriate, in the.B ldcommand..LPOptions should appear beforefilenames, except for abbreviated librarynames specified with.B \-loptions, and some binding control options specified by.BR \-B (which can appear anywhere in the line)..TP .BI \-align " datum"Force the global uninitialized data symbol.I datum(usually a .SM FORTRAN common block) to be page-aligned.  Increase its size to a whole number ofpages, and place its first byte at the start of a page..TP.BI \-assert " assertion-keyword"Check an assertion about the link editing being performed.  The assertiondesired is specified by the.I assertion-keywordstring..B ldis silent if the assertion holds, else it yields a diagnostic and aborts.Valid.IR assertion-keyword 'sand their interpretations are:.RS.RS.TP 15.B definitionsIf the resulting program were run now, there would be no run-time undefined symbol diagnostics.  This assertion is set by default..TP.B nodefinitionsPermit the successful linking of a program withunresolved references..TP.B nosymbolicThere are no symbolic relocation items remaining to be resolved..TP.B pure-textThe resulting load has no relocation items remaining in its text..RE.RE.TP.BI \-A " name"Incremental loading: linking is to be done in a manner so that theresulting object may be read into an already executing program. .I nameis the name of a file whose symbol table is taken as a basison which to define additional symbols.Only newly linked material is entered into the text and data portions of .BR a.out ,but the new symbol table will reflect all symbols defined before and afterthe incremental load. This argument must appear before any other objectfile in the argument list.One or both of the .B \-Toptions may be used as well, and will be taken to mean that the newly linkedsegment will commence at the corresponding addresses (which must be a multipleof the page size). The default value is the old value of .BR _end ..br.ne 10.TP.BI \-B binding-keywordSpecify allowed binding times for the items which follow.  Allowed values of.I binding-keywordare:.RS.TP 15.B dynamicAllow dynamic binding: do not resolve symbolic references, allow creation ofrun-time symbol and relocation environment. .B -Bdynamicis the default.When.B \-Bdynamicis in effect, all sharable objects encountered until a succeeding.B \-Bstaticmay be added dynamically to the object being linked.  Non-sharable objects are bound statically..TP.B nosymbolicDo not perform symbolic relocation, even if other options imply it..TP.B staticBind statically.  Opposite of.BR \-Bdynamic .Implied when either.B \-nor.B \-Nis specified.  Influences handling of all objectsfollowing its specification on a command line until the next.BR \-Bdynamic ..TP.B symbolicForce symbolic relocation.  Normally implied if an entry point has beenspecified with.BR \-e ,or if dynamic loading is in effect..RE.TP .B  \-dForce common storage for uninitialized variables and othercommon symbols to be allocated in the current .B ldrun, even when the.B \-rflag is present (which would otherwise postpone this bindinguntil the final linking phase)..TP.B \-dcDo.BR \-d ,but also copy initialized data referenced by this programfrom shared objects..TP.B \-dpForce an alias definition of undefined procedure entry points. Used with dynamic binding to improve sharing and the localityof run-time relocations..TP.BI \-D " hex"Pad the data segment with zero-valued bytes to make it.I hexbytes long..TP.BI \-e " entry"Define the entry point: the.I entryargument is made the name of the entry point of the loaded program.  Implies.BR \-Bsymbolic ..TP .BI \-l x\|\fR[ . v\|\fR] This option is an abbreviation for the library name.BI lib x .a\fR,where.I xis a string.  .B ldsearches for libraries first in any directories specified with.B \-Loptions, then in the standard directories.BR /lib ,.BR /usr/lib ,and.BR /usr/local/lib .A library is searched when its name is encountered, so the placement of a.B \-lis significant.  If a dynamically loadable object is found, and .B \-Bdynamicis in effect at that point on the command line, then.B ldprepares to access the object for relocation at run-time.  In such acase, the optional.BI . vsuffix can be used to indicate a specific library version..br.ne 5.TP.BI \-L dirAdd.I dirto the list of directories in which to search for libraries.Directories specified with .B \-Lare searched before the standard directories,.BR /lib ,.BR /usr/lib ,and.BR /usr/local/lib .When building a program in which one or more objects are loaded when.B -Bdynamicis in effect, those directories specified by .B \-Loptions will be \*(lqremembered\*(rq for use at execution time.  This permitsthe construction of software that uses shared objects as libraries not residingin the standard locations and avoids requiring the specification of the.SB LD_LIBRARY_PATHenvironment variablein order to execute such software.  Note that such directories areretained in.I exactlythe form specified in the option, which means that relative directoryspecifications (i.e., not beginning with \*(lq/\*(rq) will be evaluatedrelative to the current directory when the program is.IR run ,not just during the operation of.BR ld ..TP.B \-MProduce a primitive load map, listing the names of the fileswhich will be loaded..TP .B  \-nArrange (by giving the output file a 0410 \*(lqmagic number\*(rq)that when the outputfile is executed, the text portion will be read-only with the data areasplaced at the beginning of the next address boundary following the end ofthe text.  Implies.BR \-Bstatic ..TP.B \-NDo not make the text portion read-only.  (Use \*(lqmagic number\*(rq 0407.)Implies.BR \-Bstatic ..TP .BI  \-o " name".I nameis made the name of the.B ldoutput file, instead of.BR a.out ..br.ne 3.TP .B \-pArrange for the data segment to begin on a page boundary, even if the text is not shared (with the.B \-Noption)..TP .B  \-rGenerate relocation bits in the output fileso that it can be the subject of another.B ldrun.  This flag also prevents final definitions from being given to commonsymbols, and suppresses the \*(lqundefined symbol\*(rq diagnostics..TP .B \-sStrip the output, that is, remove the symbol table and relocation bits to savespace (but impair the usefulness of the debuggers).  This information can alsobe removed by.BR strip (1)..TP.B \-SStrip the output by removing all symbols except locals and globals..TP.B \-tTrace: display the name of each file as it is processed..br.ne 5.TP.BR \-T \|[\| text \|]\| \fIhex\fRStart the text segment at location.IR hex .  Specifying .B \-Tis the same as using the.B \-Ttextoption..TP.BI \-Tdata " hex"Start the data segment at location.IR hex .This option is only of useto programmers wishing to write code for .SM PROM\s0s,since the resulting code cannot be executed by the system..TP .BI  \-u " name"Enter.I nameas an undefined symbol.This is useful for loadingwholly from a library, since initially the symbol table is empty and anunresolved reference is needed to force the loading of the first routine..TP .B  \-xPreserve only global (non-\fB.globl\fP) symbols in the output symboltable; only enter external symbols.This option saves some space in the output file..TP .B \-XRecord local symbols, except for those whose names begin with.BR L .This option is used by.B ccto discard internally generated labels whileretaining symbols local to routines..TP.BI \-y symDisplay each file in which.I symappears, its type and whether the file defines or references it.Many such options may be given to trace many symbols.It is usually necessary to begin.I symwith an.RB ` _ ',as external C,.SM FORTRANand Pascal variables beginwith underscores..TP.B \-zArrange for the process demand paged from the resulting executablefile (0413 \*(lqmagic number\*(rq).  This is the default.Results in a (32-byte) header on the output file followed bytext and data segments, each of which has a multiple of page-sizebytes (being padded out withnullcharacters in the file if necessary).With this format the first few.SM BSSsegment symbols may actually end upin the data segment;this is to avoid wasting the space resulting from rounding the data segment size.  Implies.BR \-Bdynamic ..SH USAGE.SS Command Line Processing.LPIn general, options should appear ahead of the list of files toprocess.  Unless otherwise specified, theeffect of an option covers all of.B ldoperations, independentof that option's placement on the command line.  Exceptions to thisrule include some of the binding control options specified by.RB ` \-B '

⌨️ 快捷键说明

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