1 '\" te
   2 .\" Copyright 1989 AT&T
   3 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
   4 .\" Copyright (c) 2012, Joyent, Inc. All Rights Reserved
   5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
   6 .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with
   7 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   8 .TH LD 1 "Sep 10, 2013"
   9 .SH NAME
  10 ld \- link-editor for object files
  11 .SH SYNOPSIS
  12 .LP
  13 .nf
  14 \fBld\fR [\fB-32\fR | \fB-64\fR] [\fB-a\fR | \fB-r\fR] [\fB-b\fR] [\fB-B\fRdirect | nodirect]
  15 [\fB-B\fR dynamic | static] [\fB-B\fR eliminate] [\fB-B\fR group] [\fB-B\fR local]
  16 [\fB-B\fR reduce] [\fB-B\fR symbolic] [\fB-c\fR \fIname\fR] [\fB-C\fR] [\fB-d\fR y | n]
  17 [\fB-D\fR \fItoken\fR,...] [\fB-e\fR \fIepsym\fR] [\fB-f\fR \fIname\fR | \fB-F\fR \fIname\fR] [\fB-G\fR] [\fB-h\fR \fIname\fR]
  18 [\fB-i\fR] [\fB-I\fR \fIname\fR] [\fB-l\fR \fIx\fR] [\fB-L\fR \fIpath\fR] [\fB-m\fR] [\fB-M\fR \fImapfile\fR]
  19 [\fB-N\fR \fIstring\fR] [\fB-o\fR \fIoutfile\fR] [\fB-p\fR \fIauditlib\fR] [\fB-P\fR \fIauditlib\fR]
  20 [\fB-Q\fR y | n] [\fB-R\fR \fIpath\fR] [\fB-s\fR] [\fB-S\fR \fIsupportlib\fR] [\fB-t\fR]
  21 [\fB-u\fR \fIsymname\fR] [\fB-V\fR] [\fB-Y P\fR\fI,dirlist\fR] [\fB-z\fR absexec]
  22 [\fB-z\fR allextract | defaultextract | weakextract ] [\fB-z\fR altexec64]
  23 [\fB-z\fR assert-deflib ] [ \fB-z\fR assert-deflib=\fIlibname\fR ]
  24 [\fB-z\fR combreloc | nocombreloc ] [\fB-z\fR defs | nodefs]
  25 [\fB-z\fR direct | nodirect] [\fB-z\fR endfiltee]
  26 [\fB-z\fR fatal-warnings | nofatal-warnings ] [\fB-z\fR finiarray=\fIfunction\fR]
  27 [\fB-z\fR globalaudit] [\fB-z\fR groupperm | nogroupperm] 
  28 [\fB-z\fR guidance[=\fIid1\fR,\fIid2\fR...] [\fB-z\fR help ]
  29 [\fB-z\fR ignore | record] [\fB-z\fR initarray=\fIfunction\fR] [\fB-z\fR initfirst]
  30 [\fB-z\fR interpose] [\fB-z\fR lazyload | nolazyload]
  31 [\fB-z\fR ld32=\fIarg1\fR,\fIarg2\fR,...] [\fB-z\fR ld64=\fIarg1\fR,\fIarg2\fR,...]
  32 [\fB-z\fR loadfltr] [\fB-z\fR muldefs] [\fB-z\fR nocompstrtab] [\fB-z\fR nodefaultlib]
  33 [\fB-z\fR nodelete] [\fB-z\fR nodlopen] [\fB-z\fR nodump] [\fB-z\fR noldynsym]
  34 [\fB-z\fR nopartial] [\fB-z\fR noversion] [\fB-z\fR now] [\fB-z\fR origin]
  35 [\fB-z\fR preinitarray=\fIfunction\fR] [\fB-z\fR redlocsym] [\fB-z\fR relaxreloc]
  36 [\fB-z\fR rescan-now] [\fB-z\fR recan] [\fB-z\fR rescan-start \fI\&...\fR \fB-z\fR rescan-end]]
  37 [\fB-z\fR target=sparc|x86] [\fB-z\fR text | textwarn | textoff]
  38 [\fB-z\fR verbose] [\fB-z\fR wrap=\fIsymbol\fR] \fIfilename\fR...
  39 .fi
  40 
  41 .SH DESCRIPTION
  42 .sp
  43 .LP
  44 The link-editor, \fBld\fR, combines relocatable object files by resolving
  45 symbol references to symbol definitions, together with performing relocations.
  46 \fBld\fR operates in two modes, static or dynamic, as governed by the \fB-d\fR
  47 option. In all cases, the output of \fBld\fR is left in the file \fBa.out\fR by
  48 default. See NOTES.
  49 .sp
  50 .LP
  51 In dynamic mode, \fB-dy\fR, the default, relocatable object files that are
  52 provided as arguments are combined to produce an executable object file. This
  53 file is linked at execution with any shared object files that are provided as
  54 arguments. If the \fB-G\fR option is specified, relocatable object files are
  55 combined to produce a shared object. Without the \fB-G\fR option, a dynamic
  56 executable is created.
  57 .sp
  58 .LP
  59 In static mode, \fB-dn\fR, relocatable object files that are provided as
  60 arguments are combined to produce a static executable file. If the \fB-r\fR
  61 option is specified, relocatable object files are combined to produce one
  62 relocatable object file. See \fBStatic Executables\fR.
  63 .sp
  64 .LP
  65 Dynamic linking is the most common model for combining relocatable objects, and
  66 the eventual creation of processes within Solaris. This environment tightly
  67 couples the work of the link-editor and the runtime linker, \fBld.so.1\fR(1).
  68 Both of these utilities, together with their related technologies and
  69 utilities, are extensively documented in the \fILinker and Libraries Guide\fR.
  70 .sp
  71 .LP
  72 If any argument is a library, \fBld\fR by default searches the library exactly
  73 once at the point the library is encountered on the argument list. The library
  74 can be either a shared object or relocatable archive. See \fBar.h\fR(3HEAD)).
  75 .sp
  76 .LP
  77 A shared object consists of an indivisible, whole unit that has been generated
  78 by a previous link-edit of one or more input files. When the link-editor
  79 processes a shared object, the entire contents of the shared object become a
  80 logical part of the resulting output file image. The shared object is not
  81 physically copied during the link-edit as its actual inclusion is deferred
  82 until process execution. This logical inclusion means that all symbol entries
  83 defined in the shared object are made available to the link-editing process.
  84 See Chapter 4, \fIShared Objects,\fR in \fILinker and Libraries Guide\fR
  85 .sp
  86 .LP
  87 For an archive library, \fBld\fR loads only those routines that define an
  88 unresolved external reference. \fBld\fR searches the symbol table of the
  89 archive library sequentially to resolve external references that can be
  90 satisfied by library members. This search is repeated until no external
  91 references can be resolved by the archive. Thus, the order of members in the
  92 library is functionally unimportant, unless multiple library members exist that
  93 define the same external symbol. Archive libraries that have interdependencies
  94 can require multiple command line definitions, or the use of one of the
  95 \fB-z\fR \fBrescan\fR options. See \fIArchive Processing\fR in \fILinker and
  96 Libraries Guide\fR.
  97 .sp
  98 .LP
  99 \fBld\fR is a cross link-editor, able to link 32-bit objects or 64-bit objects,
 100 for Sparc or x86 targets. \fBld\fR uses the \fBELF\fR class and machine type of
 101 the first relocatable object on the command line to govern the mode in which to
 102 operate. The mixing of 32-bit objects and 64-bit objects is not permitted.
 103 Similarly, only objects of a single machine type are allowed. See the
 104 \fB-32\fR, \fB-64\fR and \fB-z target\fR options, and the \fBLD_NOEXEC_64\fR
 105 environment variable.
 106 .SS "Static Executables"
 107 .sp
 108 .LP
 109 The creation of static executables has been discouraged for many releases. In
 110 fact, 64-bit system archive libraries have never been provided. Because a
 111 static executable is built against system archive libraries, the executable
 112 contains system implementation details. This self-containment has a number of
 113 drawbacks.
 114 .RS +4
 115 .TP
 116 .ie t \(bu
 117 .el o
 118 The executable is immune to the benefits of system patches delivered as shared
 119 objects. The executable therefore, must be rebuilt to take advantage of many
 120 system improvements.
 121 .RE
 122 .RS +4
 123 .TP
 124 .ie t \(bu
 125 .el o
 126 The ability of the executable to run on future releases can be compromised.
 127 .RE
 128 .RS +4
 129 .TP
 130 .ie t \(bu
 131 .el o
 132 The duplication of system implementation details negatively affects system
 133 performance.
 134 .RE
 135 .sp
 136 .LP
 137 With Solaris 10, 32-bit system archive libraries are no longer provided.
 138 Without these libraries, specifically \fBlibc.a\fR, the creation of static
 139 executables is no longer achievable without specialized system knowledge.
 140 However, the capability of \fBld\fR to process static linking options, and the
 141 processing of archive libraries, remains unchanged.
 142 .SH OPTIONS
 143 .sp
 144 .LP
 145 The following options are supported.
 146 .sp
 147 .ne 2
 148 .na
 149 \fB\fB-32\fR | \fB-64\fR\fR
 150 .ad
 151 .sp .6
 152 .RS 4n
 153 Creates a 32-bit, or 64-bit object.
 154 .sp
 155 By default, the class of the object being generated is determined from the
 156 first \fBELF\fR object processed from the command line. If no objects are
 157 specified, the class is determined by the first object encountered within the
 158 first archive processed from the command line. If there are no objects or
 159 archives, the link-editor creates a 32-bit object.
 160 .sp
 161 The \fB-64\fR option is required to create a 64-bit object solely from a
 162 mapfile.
 163 .sp
 164 This \fB-32\fR or \fB-64\fR options can also be used in the rare case of
 165 linking entirely from an archive that contains a mixture of 32 and 64-bit
 166 objects. If the first object in the archive is not the class of the object that
 167 is required to be created, then the \fB-32\fR or \fB-64\fR option can be used
 168 to direct the link-editor. See \fIThe 32-bit link-editor and 64-bit
 169 link-editor\fR in \fILinker and Libraries Guide\fR.
 170 .RE
 171 
 172 .sp
 173 .ne 2
 174 .na
 175 \fB\fB-a\fR\fR
 176 .ad
 177 .sp .6
 178 .RS 4n
 179 In static mode only, produces an executable object file. Undefined references
 180 are not permitted. This option is the default behavior for static mode. The
 181 \fB-a\fR option can not be used with the \fB-r\fR option. See \fBStatic
 182 Executables\fR under DESCRIPTION.
 183 .RE
 184 
 185 .sp
 186 .ne 2
 187 .na
 188 \fB\fB-b\fR\fR
 189 .ad
 190 .sp .6
 191 .RS 4n
 192 In dynamic mode only, provides no special processing for dynamic executable
 193 relocations that reference symbols in shared objects. Without the \fB-b\fR
 194 option, the link-editor applies techniques within a dynamic executable so that
 195 the text segment can remain read-only. One technique is the creation of special
 196 position-independent relocations for references to functions that are defined
 197 in shared objects. Another technique arranges for data objects that are defined
 198 in shared objects to be copied into the memory image of an executable at
 199 runtime.
 200 .sp
 201 The \fB-b\fR option is intended for specialized dynamic objects and is not
 202 recommended for general use. Its use suppresses all specialized processing
 203 required to ensure an object's shareability, and can even prevent the
 204 relocation of 64-bit executables.
 205 .RE
 206 
 207 .sp
 208 .ne 2
 209 .na
 210 \fB\fB-B\fR \fBdirect\fR | \fBnodirect\fR\fR
 211 .ad
 212 .sp .6
 213 .RS 4n
 214 These options govern direct binding. \fB-B\fR \fBdirect\fR establishes direct
 215 binding information by recording the relationship between each symbol reference
 216 together with the dependency that provides the definition. In addition, direct
 217 binding information is established between each symbol reference and an
 218 associated definition within the object being created. The runtime linker uses
 219 this information to search directly for a symbol in the associated object
 220 rather than to carry out a default symbol search.
 221 .sp
 222 Direct binding information can only be established to dependencies specified
 223 with the link-edit. Thus, you should use the \fB-z\fR \fBdefs\fR option.
 224 Objects that wish to interpose on symbols in a direct binding environment
 225 should identify themselves as interposers with the \fB-z\fR \fBinterpose\fR
 226 option. The use of \fB-B\fR \fBdirect\fR enables \fB-z\fR \fBlazyload\fR for
 227 all dependencies.
 228 .sp
 229 The \fB-B\fR \fBnodirect\fR option prevents any direct binding to the
 230 interfaces offered by the object being created. The object being created can
 231 continue to directly bind to external interfaces by specifying the \fB-z\fR
 232 \fBdirect\fR option. See Appendix D, \fIDirect Bindings,\fR in \fILinker and
 233 Libraries Guide\fR.
 234 .RE
 235 
 236 .sp
 237 .ne 2
 238 .na
 239 \fB\fB-B\fR \fBdynamic\fR | \fBstatic\fR\fR
 240 .ad
 241 .sp .6
 242 .RS 4n
 243 Options governing library inclusion. \fB-B\fR \fBdynamic\fR is valid in dynamic
 244 mode only. These options can be specified any number of times on the command
 245 line as toggles: if the \fB-B\fR \fBstatic\fR option is given, no shared
 246 objects are accepted until \fB-B\fR \fBdynamic\fR is seen. See the \fB-l\fR
 247 option.
 248 .RE
 249 
 250 .sp
 251 .ne 2
 252 .na
 253 \fB\fB-B\fR \fBeliminate\fR\fR
 254 .ad
 255 .sp .6
 256 .RS 4n
 257 Causes any global symbols, not assigned to a version definition, to be
 258 eliminated from the symbol table. Version definitions can be supplied by means
 259 of a \fBmapfile\fR to indicate the global symbols that should remain visible in
 260 the generated object. This option achieves the same symbol elimination as the
 261 \fIauto-elimination\fR directive that is available as part of a \fBmapfile\fR
 262 version definition. This option can be useful when combining versioned and
 263 non-versioned relocatable objects. See also the \fB-B\fR \fBlocal\fR option and
 264 the \fB-B\fR \fBreduce\fR option. See \fIDefining Additional Symbols with a
 265 mapfile\fR in \fILinker and Libraries Guide\fR.
 266 .RE
 267 
 268 .sp
 269 .ne 2
 270 .na
 271 \fB\fB-B\fR \fBgroup\fR\fR
 272 .ad
 273 .sp .6
 274 .RS 4n
 275 Establishes a shared object and its dependencies as a group. Objects within the
 276 group are bound to other members of the group at runtime. This mode is similar
 277 to adding the object to the process by using \fBdlopen\fR(3C) with the
 278 \fBRTLD_GROUP\fR mode. An object that has an explicit dependency on a object
 279 identified as a group, becomes a member of the group.
 280 .sp
 281 As the group must be self contained, use of the \fB-B\fR \fBgroup\fR option
 282 also asserts the \fB-z\fR \fBdefs\fR option.
 283 .RE
 284 
 285 .sp
 286 .ne 2
 287 .na
 288 \fB\fB-B\fR \fBlocal\fR\fR
 289 .ad
 290 .sp .6
 291 .RS 4n
 292 Causes any global symbols, not assigned to a version definition, to be reduced
 293 to local. Version definitions can be supplied by means of a \fBmapfile\fR to
 294 indicate the global symbols that should remain visible in the generated object.
 295 This option achieves the same symbol reduction as the \fIauto-reduction\fR
 296 directive that is available as part of a \fBmapfile\fR version definition. This
 297 option can be useful when combining versioned and non-versioned relocatable
 298 objects. See also the \fB-B\fR \fBeliminate\fR option and the \fB-B\fR
 299 \fBreduce\fR option. See \fIDefining Additional Symbols with a mapfile\fR in
 300 \fILinker and Libraries Guide\fR.
 301 .RE
 302 
 303 .sp
 304 .ne 2
 305 .na
 306 \fB\fB-B\fR \fBreduce\fR\fR
 307 .ad
 308 .sp .6
 309 .RS 4n
 310 When generating a relocatable object, causes the reduction of symbolic
 311 information defined by any version definitions. Version definitions can be
 312 supplied by means of a \fBmapfile\fR to indicate the global symbols that should
 313 remain visible in the generated object. By default, when a relocatable object
 314 is generated, version definitions are only recorded in the output image. The
 315 actual reduction of symbolic information is carried out when the object is used
 316 in the construction of a dynamic executable or shared object. The \fB-B\fR
 317 \fBreduce\fR option is applied automatically when a dynamic executable or
 318 shared object is created.
 319 .RE
 320 
 321 .sp
 322 .ne 2
 323 .na
 324 \fB\fB-B\fR \fBsymbolic\fR\fR
 325 .ad
 326 .sp .6
 327 .RS 4n
 328 In dynamic mode only. When building a shared object, binds references to global
 329 symbols to their definitions, if available, within the object. Normally,
 330 references to global symbols within shared objects are not bound until runtime,
 331 even if definitions are available. This model allows definitions of the same
 332 symbol in an executable or other shared object to override the object's own
 333 definition. \fBld\fR issues warnings for undefined symbols unless \fB-z\fR
 334 \fBdefs\fR overrides.
 335 .sp
 336 The \fB-B\fR \fBsymbolic\fR option is intended for specialized dynamic objects
 337 and is not recommended for general use. To reduce the runtime relocation
 338 processing that is required an object, the creation of a version definition is
 339 recommended.
 340 .RE
 341 
 342 .sp
 343 .ne 2
 344 .na
 345 \fB\fB-c\fR \fIname\fR\fR
 346 .ad
 347 .sp .6
 348 .RS 4n
 349 Records the configuration file \fIname\fR for use at runtime. Configuration
 350 files can be employed to alter default search paths, provide a directory cache,
 351 together with providing alternative object dependencies. See \fBcrle\fR(1).
 352 .RE
 353 
 354 .sp
 355 .ne 2
 356 .na
 357 \fB\fB-C\fR\fR
 358 .ad
 359 .sp .6
 360 .RS 4n
 361 Demangles C++ symbol names displayed in diagnostic messages.
 362 .RE
 363 
 364 .sp
 365 .ne 2
 366 .na
 367 \fB\fB-d\fR \fBy\fR | \fBn\fR\fR
 368 .ad
 369 .sp .6
 370 .RS 4n
 371 When \fB-d\fR \fBy\fR, the default, is specified, \fBld\fR uses dynamic
 372 linking. When \fB-d\fR \fBn\fR is specified, \fBld\fR uses static linking. See
 373 \fBStatic Executables\fR under DESCRIPTION, and \fB-B\fR
 374 \fBdynamic\fR|\fBstatic\fR.
 375 .RE
 376 
 377 .sp
 378 .ne 2
 379 .na
 380 \fB\fB-D\fR \fItoken\fR,...\fR
 381 .ad
 382 .sp .6
 383 .RS 4n
 384 Prints debugging information as specified by each \fItoken\fR, to the standard
 385 error. The special token \fBhelp\fR indicates the full list of tokens
 386 available. See \fIDebugging Aids\fR in \fILinker and Libraries Guide\fR.
 387 .RE
 388 
 389 .sp
 390 .ne 2
 391 .na
 392 \fB\fB-e\fR \fIepsym\fR\fR
 393 .ad
 394 .br
 395 .na
 396 \fB\fB--entry\fR \fIepsym\fR\fR
 397 .ad
 398 .sp .6
 399 .RS 4n
 400 Sets the entry point address for the output file to be the symbol \fIepsym\fR.
 401 .RE
 402 
 403 .sp
 404 .ne 2
 405 .na
 406 \fB\fB-f\fR \fIname\fR\fR
 407 .ad
 408 .br
 409 .na
 410 \fB\fB--auxiliary\fR \fIname\fR\fR
 411 .ad
 412 .sp .6
 413 .RS 4n
 414 Useful only when building a shared object. Specifies that the symbol table of
 415 the shared object is used as an auxiliary filter on the symbol table of the
 416 shared object specified by \fIname\fR. Multiple instances of this option are
 417 allowed. This option can not be combined with the \fB-F\fR option. See
 418 \fIGenerating Auxiliary Filters\fR in \fILinker and Libraries Guide\fR.
 419 .RE
 420 
 421 .sp
 422 .ne 2
 423 .na
 424 \fB\fB-F\fR \fIname\fR\fR
 425 .ad
 426 .br
 427 .na
 428 \fB\fB--filter\fR \fIname\fR\fR
 429 .ad
 430 .sp .6
 431 .RS 4n
 432 Useful only when building a shared object. Specifies that the symbol table of
 433 the shared object is used as a filter on the symbol table of the shared object
 434 specified by \fIname\fR. Multiple instances of this option are allowed. This
 435 option can not be combined with the \fB-f\fR option. See \fIGenerating Standard
 436 Filters\fR in \fILinker and Libraries Guide\fR.
 437 .RE
 438 
 439 .sp
 440 .ne 2
 441 .na
 442 \fB\fB-G\fR\fR
 443 .ad
 444 .br
 445 .na
 446 \fB\fB-shared\fR\fR
 447 .ad
 448 .sp .6
 449 .RS 4n
 450 In dynamic mode only, produces a shared object. Undefined symbols are allowed.
 451 See Chapter 4, \fIShared Objects,\fR in \fILinker and Libraries Guide\fR.
 452 .RE
 453 
 454 .sp
 455 .ne 2
 456 .na
 457 \fB\fB-h\fR \fIname\fR\fR
 458 .ad
 459 .br
 460 .na
 461 \fB\fB--soname\fR \fIname\fR\fR
 462 .ad
 463 .sp .6
 464 .RS 4n
 465 In dynamic mode only, when building a shared object, records \fIname\fR in the
 466 object's dynamic section. \fIname\fR is recorded in any dynamic objects that
 467 are linked with this object rather than the object's file system name.
 468 Accordingly, \fIname\fR is used by the runtime linker as the name of the shared
 469 object to search for at runtime. See \fIRecording a Shared Object Name\fR in
 470 \fILinker and Libraries Guide\fR.
 471 .RE
 472 
 473 .sp
 474 .ne 2
 475 .na
 476 \fB\fB-i\fR\fR
 477 .ad
 478 .sp .6
 479 .RS 4n
 480 Ignores \fBLD_LIBRARY_PATH\fR. This option is useful when an
 481 \fBLD_LIBRARY_PATH\fR setting is in effect to influence the runtime library
 482 search, which would interfere with the link-editing being performed.
 483 .RE
 484 
 485 .sp
 486 .ne 2
 487 .na
 488 \fB\fB-I\fR \fIname\fR\fR
 489 .ad
 490 .br
 491 .na
 492 \fB\fB--dynamic-linker\fR \fIname\fR\fR
 493 .ad
 494 .sp .6
 495 .RS 4n
 496 When building an executable, uses \fIname\fR as the path name of the
 497 interpreter to be written into the program header. The default in static mode
 498 is no interpreter. In dynamic mode, the default is the name of the runtime
 499 linker, \fBld.so.1\fR(1). Either case can be overridden by \fB-I\fR \fIname\fR.
 500 \fBexec\fR(2) loads this interpreter when the \fBa.out\fR is loaded, and passes
 501 control to the interpreter rather than to the \fBa.out\fR directly.
 502 .RE
 503 
 504 .sp
 505 .ne 2
 506 .na
 507 \fB\fB-l\fR \fIx\fR\fR
 508 .ad
 509 .br
 510 .na
 511 \fB\fB--library\fR \fIx\fR\fR
 512 .ad
 513 .sp .6
 514 .RS 4n
 515 Searches a library \fBlib\fR\fIx\fR\fB\&.so\fR or \fBlib\fR\fIx\fR\fB\&.a\fR,
 516 the conventional names for shared object and archive libraries, respectively.
 517 In dynamic mode, unless the \fB-B\fR \fBstatic\fR option is in effect, \fBld\fR
 518 searches each directory specified in the library search path for a
 519 \fBlib\fR\fIx\fR\fB\&.so\fR or \fBlib\fR\fIx\fR\fB\&.a\fR file. The directory
 520 search stops at the first directory containing either. \fBld\fR chooses the
 521 file ending in \fB\&.so\fR if \fB-l\fR\fIx\fR expands to two files with names
 522 of the form \fBlib\fR\fIx\fR\fB\&.so\fR and \fBlib\fR\fIx\fR\fB\&.a\fR. If no
 523 \fBlib\fR\fIx\fR\fB\&.so\fR is found, then \fBld\fR accepts
 524 \fBlib\fR\fIx\fR\fB\&.a\fR. In static mode, or when the \fB-B\fR \fBstatic\fR
 525 option is in effect, \fBld\fR selects only the file ending in \fB\&.a\fR.
 526 \fBld\fR searches a library when the library is encountered, so the placement
 527 of \fB-l\fR is significant. See \fILinking With Additional Libraries\fR in
 528 \fILinker and Libraries Guide\fR.
 529 .RE
 530 
 531 .sp
 532 .ne 2
 533 .na
 534 \fB\fB-L\fR \fIpath\fR\fR
 535 .ad
 536 .br
 537 .na
 538 \fB\fB--library-path\fR \fIpath\fR\fR
 539 .ad
 540 .sp .6
 541 .RS 4n
 542 Adds \fIpath\fR to the library search directories. \fBld\fR searches for
 543 libraries first in any directories specified by the \fB-L\fR options and then
 544 in the standard directories. This option is useful only if the option precedes
 545 the \fB-l\fR options to which the \fB-L\fR option applies. See \fIDirectories
 546 Searched by the Link-Editor\fR in \fILinker and Libraries Guide\fR.
 547 .sp
 548 The environment variable \fBLD_LIBRARY_PATH\fR can be used to supplement the
 549 library search path, however the \fB-L\fR option is recommended, as the
 550 environment variable is also interpreted by the runtime environment. See
 551 \fBLD_LIBRARY_PATH\fR under ENVIRONMENT VARIABLES.
 552 .RE
 553 
 554 .sp
 555 .ne 2
 556 .na
 557 \fB\fB-m\fR\fR
 558 .ad
 559 .sp .6
 560 .RS 4n
 561 Produces a memory map or listing of the input/output sections, together with
 562 any non-fatal multiply-defined symbols, on the standard output.
 563 .RE
 564 
 565 .sp
 566 .ne 2
 567 .na
 568 \fB\fB-M\fR \fImapfile\fR\fR
 569 .ad
 570 .sp .6
 571 .RS 4n
 572 Reads \fImapfile\fR as a text file of directives to \fBld\fR. This option can
 573 be specified multiple times. If \fImapfile\fR is a directory, then all regular
 574 files, as defined by \fBstat\fR(2), within the directory are processed. See
 575 Chapter 9, \fIMapfile Option,\fR in \fILinker and Libraries Guide\fR. Example
 576 mapfiles are provided in \fB/usr/lib/ld\fR. See FILES.
 577 .RE
 578 
 579 .sp
 580 .ne 2
 581 .na
 582 \fB\fB-N\fR \fIstring\fR\fR
 583 .ad
 584 .sp .6
 585 .RS 4n
 586 This option causes a \fBDT_NEEDED\fR entry to be added to the \fB\&.dynamic\fR
 587 section of the object being built. The value of the \fBDT_NEEDED\fR string is
 588 the \fIstring\fR that is specified on the command line. This option is position
 589 dependent, and the \fBDT_NEEDED\fR \fB\&.dynamic\fR entry is relative to the
 590 other dynamic dependencies discovered on the link-edit line. This option is
 591 useful for specifying dependencies within device driver relocatable objects
 592 when combined with the \fB-dy\fR and \fB-r\fR options.
 593 .RE
 594 
 595 .sp
 596 .ne 2
 597 .na
 598 \fB\fB-o\fR \fIoutfile\fR\fR
 599 .ad
 600 .br
 601 .na
 602 \fB\fB--output\fR \fIoutfile\fR\fR
 603 .ad
 604 .sp .6
 605 .RS 4n
 606 Produces an output object file that is named \fIoutfile\fR. The name of the
 607 default object file is \fBa.out\fR.
 608 .RE
 609 
 610 .sp
 611 .ne 2
 612 .na
 613 \fB\fB-p\fR \fIauditlib\fR\fR
 614 .ad
 615 .sp .6
 616 .RS 4n
 617 Identifies an audit library, \fIauditlib\fR. This audit library is used to
 618 audit the object being created at runtime. A shared object identified as
 619 requiring auditing with the \fB-p\fR option, has this requirement inherited by
 620 any object that specifies the shared object as a dependency. See the \fB-P\fR
 621 option. See \fIRuntime Linker Auditing Interface\fR in \fILinker and Libraries
 622 Guide\fR.
 623 .RE
 624 
 625 .sp
 626 .ne 2
 627 .na
 628 \fB\fB-P\fR \fIauditlib\fR\fR
 629 .ad
 630 .sp .6
 631 .RS 4n
 632 Identifies an audit library, \fIauditlib\fR. This audit library is used to
 633 audit the dependencies of the object being created at runtime. Dependency
 634 auditing can also be inherited from dependencies that are identified as
 635 requiring auditing. See the \fB-p\fR option, and the \fB-z\fR \fBglobalaudit\fR
 636 option. See \fIRuntime Linker Auditing Interface\fR in \fILinker and Libraries
 637 Guide\fR.
 638 .RE
 639 
 640 .sp
 641 .ne 2
 642 .na
 643 \fB\fB-Q\fR \fBy\fR | \fBn\fR\fR
 644 .ad
 645 .sp .6
 646 .RS 4n
 647 Under \fB-Q\fR \fBy\fR, an \fBident\fR string is added to the \fB\&.comment\fR
 648 section of the output file. This string identifies the version of the \fBld\fR
 649 used to create the file. This results in multiple \fBld\fR \fBidents\fR when
 650 there have been multiple linking steps, such as when using \fBld\fR \fB-r\fR.
 651 This identification is identical with the default action of the \fBcc\fR
 652 command. \fB-Q\fR \fBn\fR suppresses version identification. \fB\&.comment\fR
 653 sections can be manipulated by the \fBmcs\fR(1) utility.
 654 .RE
 655 
 656 .sp
 657 .ne 2
 658 .na
 659 \fB\fB-r\fR\fR
 660 .ad
 661 .br
 662 .na
 663 \fB\fB--relocatable\fR\fR
 664 .ad
 665 .sp .6
 666 .RS 4n
 667 Combines relocatable object files to produce one relocatable object file.
 668 \fBld\fR does not complain about unresolved references. This option cannot be
 669 used with the \fB-a\fR option.
 670 .RE
 671 
 672 .sp
 673 .ne 2
 674 .na
 675 \fB\fB-R\fR \fIpath\fR\fR
 676 .ad
 677 .br
 678 .na
 679 \fB\fB-rpath\fR \fIpath\fR\fR
 680 .ad
 681 .sp .6
 682 .RS 4n
 683 A colon-separated list of directories used to specify library search
 684 directories to the runtime linker. If present and not NULL, the path is
 685 recorded in the output object file and passed to the runtime linker. Multiple
 686 instances of this option are concatenated together with each \fIpath\fR
 687 separated by a colon. See \fIDirectories Searched by the Runtime Linker\fR in
 688 \fILinker and Libraries Guide\fR.
 689 .sp
 690 The use of a runpath within an associated object is preferable to setting
 691 global search paths such as through the \fBLD_LIBRARY_PATH\fR environment
 692 variable. Only the runpaths that are necessary to find the objects dependencies
 693 should be recorded. \fBldd\fR(1) can also be used to discover unused runpaths
 694 in dynamic objects, when used with the \fB-U\fR option.
 695 .sp
 696 Various tokens can also be supplied with a runpath that provide a flexible
 697 means of identifying system capabilities or an objects location. See Appendix
 698 C, \fIEstablishing Dependencies with Dynamic String Tokens,\fR in \fILinker and
 699 Libraries Guide\fR. The \fB$ORIGIN\fR token is especially useful in allowing
 700 dynamic objects to be relocated to different locations in the file system.
 701 .RE
 702 
 703 .sp
 704 .ne 2
 705 .na
 706 \fB\fB-s\fR\fR
 707 .ad
 708 .br
 709 .na
 710 \fB\fB--strip-all\fR\fR
 711 .ad
 712 .sp .6
 713 .RS 4n
 714 Strips symbolic information from the output file. Any debugging information,
 715 that is, \fB\&.line\fR, \fB\&.debug*\fR, and \fB\&.stab*\fR sections, and their
 716 associated relocation entries are removed. Except for relocatable files, a
 717 symbol table \fBSHT_SYMTAB\fR and its associated string table section are not
 718 created in the output object file. The elimination of a \fBSHT_SYMTAB\fR symbol
 719 table can reduce the \fB\&.stab*\fR debugging information that is generated
 720 using the compiler drivers \fB-g\fR option. See the \fB-z\fR \fBredlocsym\fR
 721 and \fB-z\fR \fBnoldynsym\fR options.
 722 .RE
 723 
 724 .sp
 725 .ne 2
 726 .na
 727 \fB\fB-S\fR \fIsupportlib\fR\fR
 728 .ad
 729 .sp .6
 730 .RS 4n
 731 The shared object \fIsupportlib\fR is loaded with \fBld\fR and given
 732 information regarding the linking process. Shared objects that are defined by
 733 using the \fB-S\fR option can also be supplied using the \fBSGS_SUPPORT\fR
 734 environment variable. See \fILink-Editor Support Interface\fR in \fILinker and
 735 Libraries Guide\fR.
 736 .RE
 737 
 738 .sp
 739 .ne 2
 740 .na
 741 \fB\fB-t\fR\fR
 742 .ad
 743 .sp .6
 744 .RS 4n
 745 Turns off the warning for multiply-defined symbols that have different sizes or
 746 different alignments.
 747 .RE
 748 
 749 .sp
 750 .ne 2
 751 .na
 752 \fB\fB-u\fR \fIsymname\fR\fR
 753 .ad
 754 .br
 755 .na
 756 \fB\fB--undefined\fR \fIsymname\fR\fR
 757 .ad
 758 .sp .6
 759 .RS 4n
 760 Enters \fIsymname\fR as an undefined symbol in the symbol table. This option is
 761 useful for loading entirely from an archive library. In this instance, an
 762 unresolved reference is needed to force the loading of the first routine. The
 763 placement of this option on the command line is significant. This option must
 764 be placed before the library that defines the symbol. See \fIDefining
 765 Additional Symbols with the u option\fR in \fILinker and Libraries Guide\fR.
 766 .RE
 767 
 768 .sp
 769 .ne 2
 770 .na
 771 \fB\fB-V\fR\fR
 772 .ad
 773 .br
 774 .na
 775 \fB\fB--version\fR\fR
 776 .ad
 777 .sp .6
 778 .RS 4n
 779 Outputs a message giving information about the version of \fBld\fR being used.
 780 .RE
 781 
 782 .sp
 783 .ne 2
 784 .na
 785 \fB\fB-Y\fR \fBP,\fR\fIdirlist\fR\fR
 786 .ad
 787 .sp .6
 788 .RS 4n
 789 Changes the default directories used for finding libraries. \fIdirlist\fR is a
 790 colon-separated path list.
 791 .RE
 792 
 793 .sp
 794 .ne 2
 795 .na
 796 \fB\fB-z\fR \fBabsexec\fR\fR
 797 .ad
 798 .sp .6
 799 .RS 4n
 800 Useful only when building a dynamic executable. Specifies that references to
 801 external absolute symbols should be resolved immediately instead of being left
 802 for resolution at runtime. In very specialized circumstances, this option
 803 removes text relocations that can result in excessive swap space demands by an
 804 executable.
 805 .RE
 806 
 807 .sp
 808 .ne 2
 809 .na
 810 \fB\fB-z\fR \fBallextract\fR | \fBdefaultextract\fR | \fBweakextract\fR\fR
 811 .ad
 812 .br
 813 .na
 814 \fB\fB--whole-archive\fR | \fB--no-whole-archive\fR\fR
 815 .ad
 816 .sp .6
 817 .RS 4n
 818 Alters the extraction criteria of objects from any archives that follow. By
 819 default, archive members are extracted to satisfy undefined references and to
 820 promote tentative definitions with data definitions. Weak symbol references do
 821 not trigger extraction. Under the \fB-z\fR \fBallextract\fR or
 822 \fB--whole-archive\fR options, all archive members are extracted from the
 823 archive. Under \fB-z\fR \fBweakextract\fR, weak references trigger archive
 824 extraction. The \fB-z\fR \fBdefaultextract\fR or \fB--no-whole-archive\fR
 825 options provide a means of returning to the default following use of the former
 826 extract options. See \fIArchive Processing\fR in \fILinker and Libraries
 827 Guide\fR.
 828 .RE
 829 
 830 .sp
 831 .ne 2
 832 .na
 833 \fB\fB-z\fR \fBaltexec64\fR\fR
 834 .ad
 835 .sp .6
 836 .RS 4n
 837 Execute the 64-bit \fBld\fR. The creation of very large 32-bit objects can
 838 exhaust the virtual memory that is available to the 32-bit \fBld\fR. The
 839 \fB-z\fR \fBaltexec64\fR option can be used to force the use of the associated
 840 64-bit \fBld\fR. The 64-bit \fBld\fR provides a larger virtual address space
 841 for building 32-bit objects. See \fIThe 32-bit link-editor and 64-bit
 842 link-editor\fR in \fILinker and Libraries Guide\fR.
 843 .RE
 844 
 845 .sp
 846 .ne 2
 847 .na
 848 \fB\fB-z\fR \fBcombreloc\fR | \fBnocombreloc\fR\fR
 849 .ad
 850 .sp .6
 851 .RS 4n
 852 By default, \fBld\fR combines multiple relocation sections when building
 853 executables or shared objects. This section combination differs from
 854 relocatable objects, in which relocation sections are maintained in a
 855 one-to-one relationship with the sections to which the relocations must be
 856 applied. The \fB-z\fR \fBnocombreloc\fR option disables this merging of
 857 relocation sections, and preserves the one-to-one relationship found in the
 858 original relocatable objects.
 859 .sp
 860 \fBld\fR sorts the entries of data relocation sections by their symbol
 861 reference. This sorting reduces runtime symbol lookup. When multiple relocation
 862 sections are combined, this sorting produces the least possible relocation
 863 overhead when objects are loaded into memory, and speeds the runtime loading of
 864 dynamic objects.
 865 .sp
 866 Historically, the individual relocation sections were carried over to any
 867 executable or shared object, and the \fB-z\fR \fBcombreloc\fR option was
 868 required to enable the relocation section merging previously described.
 869 Relocation section merging is now the default. The \fB-z\fR \fBcombreloc\fR
 870 option is still accepted for the benefit of old build environments, but the
 871 option is unnecessary, and has no effect.
 872 .RE
 873 
 874 .sp
 875 .ne 2
 876 .na
 877 \fB\fB-z\fR \fBassert-deflib\fR\fR
 878 .ad
 879 .br
 880 .na
 881 \fB\fB-z\fR \fBassert-deflib=\fR\fIlibname\fR\fR
 882 .ad
 883 .sp .6
 884 .RS 4n
 885 Enables warnings that check the location of where libraries passed in with
 886 \fB-l\fR are found. If the link-editor finds a library on its default search
 887 path it will emit a warning. This warning can be made fatal in conjunction with
 888 the option \fB-z fatal-warnings\fR. Passing \fIlibname\fR white lists a library
 889 from this check. The library must be the full name of the library, e.g.
 890 \fIlibc.so\fR. To white list multiple libraries, the \fB-z
 891 assert-deflib=\fR\fIlibname\fR option can be repeated multiple times. This
 892 option is useful when trying to build self-contained objects where a referenced
 893 library might exist in the default system library path and in alternate paths
 894 specified by \fB-L\fR, but you only want the alternate paths to be used.
 895 .RE
 896 
 897 .sp
 898 .ne 2
 899 .na
 900 \fB\fB-z\fR \fBdefs\fR | \fBnodefs\fR\fR
 901 .ad
 902 .br
 903 .na
 904 \fB\fB--no-undefined\fR\fR
 905 .ad
 906 .sp .6
 907 .RS 4n
 908 The \fB-z\fR \fBdefs\fR option and the \fB--no-undefined\fR option force a
 909 fatal error if any undefined symbols remain at the end of the link. This mode
 910 is the default when an executable is built. For historic reasons, this mode is
 911 \fBnot\fR the default when building a shared object. Use of the \fB-z\fR
 912 \fBdefs\fR option is recommended, as this mode assures the object being built
 913 is self-contained. A self-contained object has all symbolic references resolved
 914 internally, or to the object's immediate dependencies.
 915 .sp
 916 The \fB-z\fR \fBnodefs\fR option allows undefined symbols. For historic
 917 reasons, this mode is the default when a shared object is built. When used with
 918 executables, the behavior of references to such undefined symbols is
 919 unspecified. Use of the \fB-z\fR \fBnodefs\fR option is not recommended.
 920 .RE
 921 
 922 .sp
 923 .ne 2
 924 .na
 925 \fB\fB-z\fR \fBdirect\fR | \fBnodirect\fR\fR
 926 .ad
 927 .sp .6
 928 .RS 4n
 929 Enables or disables direct binding to any dependencies that follow on the
 930 command line. These options allow finer control over direct binding than the
 931 global counterpart \fB-B\fR \fBdirect\fR. The \fB-z\fR \fBdirect\fR option also
 932 differs from the \fB-B\fR \fBdirect\fR option in the following areas. Direct
 933 binding information is not established between a symbol reference and an
 934 associated definition within the object being created. Lazy loading is not
 935 enabled.
 936 .RE
 937 
 938 .sp
 939 .ne 2
 940 .na
 941 \fB\fB-z\fR \fBendfiltee\fR\fR
 942 .ad
 943 .sp .6
 944 .RS 4n
 945 Marks a filtee so that when processed by a filter, the filtee terminates any
 946 further filtee searches by the filter. See \fIReducing Filtee Searches\fR in
 947 \fILinker and Libraries Guide\fR.
 948 .RE
 949 
 950 .sp
 951 .ne 2
 952 .na
 953 \fB\fB-z\fR \fBfatal-warnings\fR | \fBnofatal-warnings\fR\fR
 954 .ad
 955 .br
 956 .na
 957 \fB\fB--fatal-warnings\fR | \fB--no-fatal-warnings\fR
 958 .ad
 959 .sp .6
 960 .RS 4n
 961 Controls the behavior of warnings emitted from the link-editor. Setting \fB-z
 962 fatal-warnings\fR promotes warnings emitted by the link-editor to fatal errors
 963 that will cause the link-editor to fail before linking. \fB-z
 964 nofatal-warnings\fR instead demotes these warnings such that they will not cause
 965 the link-editor to exit prematurely.
 966 .RE
 967 
 968 
 969 .sp
 970 .ne 2
 971 .na
 972 \fB\fB-z\fR \fBfiniarray=\fR\fIfunction\fR\fR
 973 .ad
 974 .sp .6
 975 .RS 4n
 976 Appends an entry to the \fB\&.finiarray\fR section of the object being built.
 977 If no \fB\&.finiarray\fR section is present, a section is created. The new
 978 entry is initialized to point to \fIfunction\fR. See \fIInitialization and
 979 Termination Sections\fR in \fILinker and Libraries Guide\fR.
 980 .RE
 981 
 982 .sp
 983 .ne 2
 984 .na
 985 \fB\fB-z\fR \fBglobalaudit\fR\fR
 986 .ad
 987 .sp .6
 988 .RS 4n
 989 This option supplements an audit library definition that has been recorded with
 990 the \fB-P\fR option. This option is only meaningful when building a dynamic
 991 executable. Audit libraries that are defined within an object with the \fB-P\fR
 992 option typically allow for the auditing of the immediate dependencies of the
 993 object. The \fB-z\fR \fBglobalaudit\fR promotes the auditor to a global
 994 auditor, thus allowing the auditing of all dependencies. See \fIInvoking the
 995 Auditing Interface\fR in \fILinker and Libraries Guide\fR.
 996 .sp
 997 An auditor established with the \fB-P\fR option and the \fB-z\fR
 998 \fBglobalaudit\fR option, is equivalent to the auditor being established with
 999 the \fBLD_AUDIT\fR environment variable. See \fBld.so.1\fR(1).
1000 .RE
1001 
1002 .sp
1003 .ne 2
1004 .na
1005 \fB\fB-z\fR \fBgroupperm\fR | \fBnogroupperm\fR\fR
1006 .ad
1007 .sp .6
1008 .RS 4n
1009 Assigns, or deassigns each dependency that follows to a unique group. The
1010 assignment of a dependency to a group has the same effect as if the dependency
1011 had been built using the \fB-B\fR \fBgroup\fR option.
1012 .RE
1013 
1014 .sp
1015 .ne 2
1016 .na
1017 \fB-z\fR \fBguidance\fR[=\fIid1\fR,\fIid2\fR...]
1018 .ad
1019 .sp .6
1020 .RS 4n
1021 Give messages suggesting link-editor features that could improve the resulting
1022 dynamic object.
1023 .LP
1024 Specific classes of suggestion can be silenced by specifying an optional comma separated
1025 list of guidance identifiers.
1026 .LP
1027 The current classes of suggestion provided are:
1028 
1029 .sp
1030 .ne 2
1031 .na
1032 Enable use of direct binding
1033 .ad
1034 .sp .6
1035 .RS 4n
1036 Suggests that \fB-z direct\fR or \fB-B direct\fR be present prior to any
1037 specified dependency.  This allows predictable symbol binding at runtime.
1038 
1039 Can be disabled with \fB-z guidance=nodirect\fR
1040 .RE
1041 
1042 .sp
1043 .ne 2
1044 .na
1045 Enable lazy dependency loading
1046 .ad
1047 .sp .6
1048 .RS 4n
1049 Suggests that \fB-z lazyload\fR be present prior to any specified dependency.
1050 This allows the dynamic object to be loaded more quickly.
1051 
1052 Can be disabled with \fB-z guidance=nolazyload\fR.
1053 .RE
1054 
1055 .sp
1056 .ne 2
1057 .na
1058 Shared objects should define all their dependencies.
1059 .ad
1060 .sp .6
1061 .RS 4n
1062 Suggests that \fB-z defs\fR be specified on the link-editor command line.
1063 Shared objects that explicitly state all their dependencies behave more
1064 predictably when used.
1065 
1066 Can be be disabled with \fB-z guidance=nodefs\fR
1067 .RE
1068 
1069 .sp
1070 .ne 2
1071 .na
1072 Version 2 mapfile syntax
1073 .ad
1074 .sp .6
1075 .RS 4n
1076 Suggests that any specified mapfiles use the more readable version 2 syntax.
1077 
1078 Can be disabled with \fB-z guidance=nomapfile\fR.
1079 .RE
1080 
1081 .sp
1082 .ne 2
1083 .na
1084 Read-only text segment
1085 .ad
1086 .sp .6
1087 .RS 4n
1088 Should any runtime relocations within the text segment exist, suggests that
1089 the object be compiled with position independent code (PIC).  Keeping large
1090 allocatable sections read-only allows them to be shared between processes
1091 using a given shared object.
1092 
1093 Can be disabled with \fB-z guidance=notext\fR
1094 .RE
1095 
1096 .sp
1097 .ne 2
1098 .na
1099 No unused dependencies
1100 .ad
1101 .sp .6
1102 .RS 4n
1103 Suggests that any dependency not referenced by the resulting dynamic object be
1104 removed from the link-editor command line.
1105 
1106 Can be disabled with \fB-z guidance=nounused\fR.
1107 .RE
1108 .RE
1109 
1110 .sp
1111 .ne 2
1112 .na
1113 \fB\fB-z\fR \fBhelp\fR\fR
1114 .ad
1115 .br
1116 .na
1117 \fB\fB--help\fR\fR
1118 .ad
1119 .sp .6
1120 .RS 4n
1121 Print a summary of the command line options on the standard output and exit.
1122 .RE
1123 
1124 .sp
1125 .ne 2
1126 .na
1127 \fB\fB-z\fR \fBignore\fR | \fBrecord\fR\fR
1128 .ad
1129 .sp .6
1130 .RS 4n
1131 Ignores, or records, dynamic dependencies that are not referenced as part of
1132 the link-edit. Ignores, or records, unreferenced \fBELF\fR sections from the
1133 relocatable objects that are read as part of the link-edit. By default,
1134 \fB-z\fR \fBrecord\fR is in effect.
1135 .sp
1136 If an \fBELF\fR section is ignored, the section is eliminated from the output
1137 file being generated. A section is ignored when three conditions are true. The
1138 eliminated section must contribute to an allocatable segment. The eliminated
1139 section must provide no global symbols. No other section from any object that
1140 contributes to the link-edit, must reference an eliminated section.
1141 .RE
1142 
1143 .sp
1144 .ne 2
1145 .na
1146 \fB\fB-z\fR \fBinitarray=\fR\fIfunction\fR\fR
1147 .ad
1148 .sp .6
1149 .RS 4n
1150 Appends an entry to the \fB\&.initarray\fR section of the object being built.
1151 If no \fB\&.initarray\fR section is present, a section is created. The new
1152 entry is initialized to point to \fIfunction\fR. See \fIInitialization and
1153 Termination Sections\fR in \fILinker and Libraries Guide\fR.
1154 .RE
1155 
1156 .sp
1157 .ne 2
1158 .na
1159 \fB\fB-z\fR \fBinitfirst\fR\fR
1160 .ad
1161 .sp .6
1162 .RS 4n
1163 Marks the object so that its runtime initialization occurs before the runtime
1164 initialization of any other objects brought into the process at the same time.
1165 In addition, the object runtime finalization occurs after the runtime
1166 finalization of any other objects removed from the process at the same time.
1167 This option is only meaningful when building a shared object.
1168 .RE
1169 
1170 .sp
1171 .ne 2
1172 .na
1173 \fB\fB-z\fR \fBinterpose\fR\fR
1174 .ad
1175 .sp .6
1176 .RS 4n
1177 Marks the object as an interposer. At runtime, an object is identified as an
1178 explicit interposer if the object has been tagged using the \fB-z interpose\fR
1179 option. An explicit interposer is also established when an object is loaded
1180 using the \fBLD_PRELOAD\fR environment variable. Implicit interposition can
1181 occur because of the load order of objects, however, this implicit
1182 interposition is unknown to the runtime linker. Explicit interposition can
1183 ensure that interposition takes place regardless of the order in which objects
1184 are loaded. Explicit interposition also ensures that the runtime linker
1185 searches for symbols in any explicit interposers when direct bindings are in
1186 effect.
1187 .RE
1188 
1189 .sp
1190 .ne 2
1191 .na
1192 \fB\fB-z\fR \fBlazyload\fR | \fBnolazyload\fR\fR
1193 .ad
1194 .sp .6
1195 .RS 4n
1196 Enables or disables the marking of dynamic dependencies to be lazily loaded.
1197 Dynamic dependencies which are marked \fBlazyload\fR are not loaded at initial
1198 process start-up. These dependencies are delayed until the first binding to the
1199 object is made. \fBNote:\fR Lazy loading requires the correct declaration of
1200 dependencies, together with associated runpaths for each dynamic object used
1201 within a process. See \fILazy Loading of Dynamic Dependencies\fR in \fILinker
1202 and Libraries Guide\fR.
1203 .RE
1204 
1205 .sp
1206 .ne 2
1207 .na
1208 \fB\fB-z\fR \fBld32\fR=\fIarg1\fR,\fIarg2\fR,...\fR
1209 .ad
1210 .br
1211 .na
1212 \fB\fB-z\fR \fBld64\fR=\fIarg1\fR,\fIarg2\fR,...\fR
1213 .ad
1214 .sp .6
1215 .RS 4n
1216 The class of the link-editor is affected by the class of the output file being
1217 created and by the capabilities of the underlying operating system. The
1218 \fB-z\fR \fBld\fR[\fB32\fR|\fB64\fR] options provide a means of defining any
1219 link-editor argument. The defined argument is only interpreted, respectively,
1220 by the 32-bit class or 64-bit class of the link-editor.
1221 .sp
1222 For example, support libraries are class specific, so the correct class of
1223 support library can be ensured using:
1224 .sp
1225 .in +2
1226 .nf
1227 \fBld ... -z ld32=-Saudit32.so.1 -z ld64=-Saudit64.so.1 ...\fR
1228 .fi
1229 .in -2
1230 .sp
1231 
1232 The class of link-editor that is invoked is determined from the \fBELF\fR class
1233 of the first relocatable file that is seen on the command line. This
1234 determination is carried out \fBprior\fR to any \fB-z\fR
1235 \fBld\fR[\fB32\fR|\fB64\fR] processing.
1236 .RE
1237 
1238 .sp
1239 .ne 2
1240 .na
1241 \fB\fB-z\fR \fBloadfltr\fR\fR
1242 .ad
1243 .sp .6
1244 .RS 4n
1245 Marks a filter to indicate that filtees must be processed immediately at
1246 runtime. Normally, filter processing is delayed until a symbol reference is
1247 bound to the filter. The runtime processing of an object that contains this
1248 flag mimics that which occurs if the \fBLD_LOADFLTR\fR environment variable is
1249 in effect. See the \fBld.so.1\fR(1).
1250 .RE
1251 
1252 .sp
1253 .ne 2
1254 .na
1255 \fB\fB-z\fR \fBmuldefs\fR\fR
1256 .ad
1257 .br
1258 .na
1259 \fB\fB--allow-multiple-definition\fR\fR
1260 .ad
1261 .sp .6
1262 .RS 4n
1263 Allows multiple symbol definitions. By default, multiple symbol definitions
1264 that occur between relocatable objects result in a fatal error condition. This
1265 option, suppresses the error condition, allowing the first symbol definition to
1266 be taken.
1267 .RE
1268 
1269 .sp
1270 .ne 2
1271 .na
1272 \fB\fB-z\fR \fBnocompstrtab\fR\fR
1273 .ad
1274 .sp .6
1275 .RS 4n
1276 Disables the compression of \fBELF\fR string tables. By default, string
1277 compression is applied to \fBSHT_STRTAB\fR sections, and to \fBSHT_PROGBITS\fR
1278 sections that have their \fBSHF_MERGE\fR and \fBSHF_STRINGS\fR section flags
1279 set.
1280 .RE
1281 
1282 .sp
1283 .ne 2
1284 .na
1285 \fB\fB-z\fR \fBnodefaultlib\fR\fR
1286 .ad
1287 .sp .6
1288 .RS 4n
1289 Marks the object so that the runtime default library search path, used after
1290 any \fBLD_LIBRARY_PATH\fR or runpaths, is ignored. This option implies that all
1291 dependencies of the object can be satisfied from its runpath.
1292 .RE
1293 
1294 .sp
1295 .ne 2
1296 .na
1297 \fB\fB-z\fR \fBnodelete\fR\fR
1298 .ad
1299 .sp .6
1300 .RS 4n
1301 Marks the object as non-deletable at runtime. This mode is similar to adding
1302 the object to the process by using \fBdlopen\fR(3C) with the
1303 \fBRTLD_NODELETE\fR mode.
1304 .RE
1305 
1306 .sp
1307 .ne 2
1308 .na
1309 \fB\fB-z\fR \fBnodlopen\fR\fR
1310 .ad
1311 .sp .6
1312 .RS 4n
1313 Marks the object as not available to \fBdlopen\fR(3C), either as the object
1314 specified by the \fBdlopen()\fR, or as any form of dependency required by the
1315 object specified by the \fBdlopen()\fR. This option is only meaningful when
1316 building a shared object.
1317 .RE
1318 
1319 .sp
1320 .ne 2
1321 .na
1322 \fB\fB-z\fR \fBnodump\fR\fR
1323 .ad
1324 .sp .6
1325 .RS 4n
1326 Marks the object as not available to \fBdldump\fR(3C).
1327 .RE
1328 
1329 .sp
1330 .ne 2
1331 .na
1332 \fB\fB-z\fR \fBnoldynsym\fR\fR
1333 .ad
1334 .sp .6
1335 .RS 4n
1336 Prevents the inclusion of a \fB\&.SUNW_ldynsym\fR section in dynamic
1337 executables or sharable libraries. The \fB\&.SUNW_ldynsym\fR section augments
1338 the \fB\&.dynsym\fR section by providing symbols for local functions. Local
1339 function symbols allow debuggers to display local function names in stack
1340 traces from stripped programs. Similarly, \fBdladdr\fR(3C) is able to supply
1341 more accurate results.
1342 .sp
1343 The \fB-z\fR \fBnoldynsym\fR option also prevents the inclusion of the two
1344 symbol sort sections that are related to the \fB\&.SUNW_ldynsym\fR section. The
1345 \fB\&.SUNW_dynsymsort\fR section provides sorted access to regular function and
1346 variable symbols. The \fB\&.SUNW_dyntlssort\fR section provides sorted access
1347 to thread local storage (\fBTLS\fR) variable symbols.
1348 .sp
1349 The \fB\&.SUNW_ldynsym\fR, \fB\&.SUNW_dynsymsort\fR, and
1350 \fB\&.SUNW_dyntlssort\fR sections, which becomes part of the allocable text
1351 segment of the resulting file, cannot be removed by \fBstrip\fR(1). Therefore,
1352 the \fB-z\fR \fBnoldynsym\fR option is the only way to prevent their inclusion.
1353 See the \fB-s\fR and \fB-z\fR \fBredlocsym\fR options.
1354 .RE
1355 
1356 .sp
1357 .ne 2
1358 .na
1359 \fB\fB-z\fR \fBnopartial\fR\fR
1360 .ad
1361 .sp .6
1362 .RS 4n
1363 Partially initialized symbols, that are defined within relocatable object
1364 files, are expanded in the output file being generated.
1365 .RE
1366 
1367 .sp
1368 .ne 2
1369 .na
1370 \fB\fB-z\fR \fBnoversion\fR\fR
1371 .ad
1372 .sp .6
1373 .RS 4n
1374 Does not record any versioning sections. Any version sections or associated
1375 \fB\&.dynamic\fR section entries are not generated in the output image.
1376 .RE
1377 
1378 .sp
1379 .ne 2
1380 .na
1381 \fB\fB-z\fR \fBnow\fR\fR
1382 .ad
1383 .sp .6
1384 .RS 4n
1385 Marks the object as requiring non-lazy runtime binding. This mode is similar to
1386 adding the object to the process by using \fBdlopen\fR(3C) with the
1387 \fBRTLD_NOW\fR mode. This mode is also similar to having the \fBLD_BIND_NOW\fR
1388 environment variable in effect. See \fBld.so.1\fR(1).
1389 .RE
1390 
1391 .sp
1392 .ne 2
1393 .na
1394 \fB\fB-z\fR \fBorigin\fR\fR
1395 .ad
1396 .sp .6
1397 .RS 4n
1398 Marks the object as requiring immediate \fB$ORIGIN\fR processing at runtime.
1399 This option is only maintained for historic compatibility, as the runtime
1400 analysis of objects to provide for \fB$ORIGIN\fR processing is now default.
1401 .RE
1402 
1403 .sp
1404 .ne 2
1405 .na
1406 \fB\fB-z\fR \fBpreinitarray=\fR\fIfunction\fR\fR
1407 .ad
1408 .sp .6
1409 .RS 4n
1410 Appends an entry to the \fB\&.preinitarray\fR section of the object being
1411 built. If no \fB\&.preinitarray\fR section is present, a section is created.
1412 The new entry is initialized to point to \fIfunction\fR. See \fIInitialization
1413 and Termination Sections\fR in \fILinker and Libraries Guide\fR.
1414 .RE
1415 
1416 .sp
1417 .ne 2
1418 .na
1419 \fB\fB-z\fR \fBredlocsym\fR\fR
1420 .ad
1421 .sp .6
1422 .RS 4n
1423 Eliminates all local symbols except for the \fISECT\fR symbols from the symbol
1424 table \fBSHT_SYMTAB\fR. All relocations that refer to local symbols are updated
1425 to refer to the corresponding \fISECT\fR symbol. This option allows specialized
1426 objects to greatly reduce their symbol table sizes. Eliminated local symbols
1427 can reduce the \fB\&.stab*\fR debugging information that is generated using the
1428 compiler drivers \fB-g\fR option. See the \fB-s\fR and \fB-z\fR \fBnoldynsym\fR
1429 options.
1430 .RE
1431 
1432 .sp
1433 .ne 2
1434 .na
1435 \fB\fB-z\fR \fBrelaxreloc\fR\fR
1436 .ad
1437 .sp .6
1438 .RS 4n
1439 \fBld\fR normally issues a fatal error upon encountering a relocation using a
1440 symbol that references an eliminated COMDAT section. If \fB-z\fR
1441 \fBrelaxreloc\fR is enabled, \fBld\fR instead redirects such relocations to the
1442 equivalent symbol in the COMDAT section that was kept. \fB-z\fR
1443 \fBrelaxreloc\fR is a specialized option, mainly of interest to compiler
1444 authors, and is not intended for general use.
1445 .RE
1446 
1447 .sp
1448 .ne 2
1449 .na
1450 \fB\fB-z\fR \fBrescan-now\fR\fR
1451 .ad
1452 .br
1453 .na
1454 \fB\fB-z\fR \fBrescan\fR\fR
1455 .ad
1456 .sp .6
1457 .RS 4n
1458 These options rescan the archive files that are provided to the link-edit. By
1459 default, archives are processed once as the archives appear on the command
1460 line. Archives are traditionally specified at the end of the command line so
1461 that their symbol definitions resolve any preceding references. However,
1462 specifying archives multiple times to satisfy their own interdependencies can
1463 be necessary.
1464 .sp
1465 \fB-z\fR \fBrescan-now\fR is a positional option, and is processed by the
1466 link-editor immediately when encountered on the command line. All archives seen
1467 on the command line up to that point are immediately reprocessed in an attempt
1468 to locate additional archive members that resolve symbol references. This
1469 archive rescanning is repeated until a pass over the archives occurs in which
1470 no new members are extracted.
1471 .sp
1472 \fB-z\fR \fBrescan\fR is a position independent option. The link-editor defers
1473 the rescan operation until after it has processed the entire command line, and
1474 then initiates a final rescan operation over all archives seen on the command
1475 line. The \fB-z\fR \fBrescan\fR operation can interact          incorrectly
1476 with objects that contain initialization (.init) or finalization (.fini)
1477 sections, preventing the code in those sections from running. For this reason,
1478 \fB-z\fR \fBrescan\fR is deprecated, and use of \fB-z\fR \fBrescan-now\fR is
1479 advised.
1480 .RE
1481 
1482 .sp
1483 .ne 2
1484 .na
1485 \fB\fB-z\fR \fBrescan-start\fR ... \fB-z\fR \fBrescan-end\fR\fR
1486 .ad
1487 .br
1488 .na
1489 \fB\fB--start-group\fR ... \fB--end-group\fR\fR
1490 .ad
1491 .br
1492 .na
1493 \fB\fB-(\fR ... \fB-)\fR\fR
1494 .ad
1495 .sp .6
1496 .RS 4n
1497 Defines an archive rescan group. This is a positional construct, and is
1498 processed by the link-editor immediately upon encountering the closing
1499 delimiter option.  Archives found within the group delimiter options are
1500 reprocessed as a group in an attempt to locate  additional archive members that
1501 resolve symbol references. This archive rescanning  is repeated  until a  pass
1502 over the archives On the occurs in  which no  new  members are extracted.
1503 Archive rescan groups cannot be nested.
1504 .RE
1505 
1506 .sp
1507 .ne 2
1508 .na
1509 \fB\fB-z\fR \fBtarget=sparc|x86\fR \fI\fR\fR
1510 .ad
1511 .sp .6
1512 .RS 4n
1513 Specifies the machine type for the output object. Supported targets are Sparc
1514 and x86. The 32-bit machine type for the specified target is used unless the
1515 \fB-64\fR option is also present, in which case the corresponding 64-bit
1516 machine type is used. By default, the machine type of the object being
1517 generated is determined from the first \fBELF\fR object processed from the
1518 command line. If no objects are specified, the machine type is determined by
1519 the first object encountered within the first archive processed from the
1520 command line. If there are no objects or archives, the link-editor assumes the
1521 native machine. This option is useful when creating an object directly with
1522 \fBld\fR whose input is solely from a \fBmapfile\fR. See the \fB-M\fR option.
1523 It can also be useful in the rare case of linking entirely from an archive that
1524 contains objects of different machine types for which the first object is not
1525 of the desired machine type. See \fIThe 32-bit link-editor and 64-bit
1526 link-editor\fR in \fILinker and Libraries Guide\fR.
1527 .RE
1528 
1529 .sp
1530 .ne 2
1531 .na
1532 \fB\fB-z\fR \fBtext\fR\fR
1533 .ad
1534 .sp .6
1535 .RS 4n
1536 In dynamic mode only, forces a fatal error if any relocations against
1537 non-writable, allocatable sections remain. For historic reasons, this mode is
1538 not the default when building an executable or shared object. However, its use
1539 is recommended to ensure that the text segment of the dynamic object being
1540 built is shareable between multiple running processes. A shared text segment
1541 incurs the least relocation overhead when loaded into memory. See
1542 \fIPosition-Independent Code\fR in \fILinker and Libraries Guide\fR.
1543 .RE
1544 
1545 .sp
1546 .ne 2
1547 .na
1548 \fB\fB-z\fR \fBtextoff\fR\fR
1549 .ad
1550 .sp .6
1551 .RS 4n
1552 In dynamic mode only, allows relocations against all allocatable sections,
1553 including non-writable ones. This mode is the default when building a shared
1554 object.
1555 .RE
1556 
1557 .sp
1558 .ne 2
1559 .na
1560 \fB\fB-z\fR \fBtextwarn\fR\fR
1561 .ad
1562 .sp .6
1563 .RS 4n
1564 In dynamic mode only, lists a warning if any relocations against non-writable,
1565 allocatable sections remain. This mode is the default when building an
1566 executable.
1567 .RE
1568 
1569 .sp
1570 .ne 2
1571 .na
1572 \fB\fB-z\fR \fBverbose\fR\fR
1573 .ad
1574 .sp .6
1575 .RS 4n
1576 This option provides additional warning diagnostics during a link-edit.
1577 Presently, this option conveys suspicious use of displacement relocations. This
1578 option also conveys the restricted use of static \fBTLS\fR relocations when
1579 building shared objects. In future, this option might be enhanced to provide
1580 additional diagnostics that are deemed too noisy to be generated by default.
1581 .RE
1582 
1583 .sp
1584 .ne 2
1585 .na
1586 \fB\fB-z\fR\fBwrap=\fR\fIsymbol\fR\fR
1587 .ad
1588 .br
1589 .na
1590 \fB\fB-wrap=\fR \fIsymbol\fR\fR
1591 .ad
1592 .br
1593 .na
1594 \fB\fB--wrap=\fR \fIsymbol\fR\fR
1595 .ad
1596 .sp .6
1597 .RS 4n
1598 Rename undefined references to \fIsymbol\fR in order to allow wrapper code to
1599 be linked into the output object without having to modify source code. When
1600 \fB-z wrap\fR is specified, all undefined references to \fIsymbol\fR are
1601 modified to reference \fB__wrap_\fR\fIsymbol\fR, and all references to
1602 \fB__real_\fR\fIsymbol\fR are modified to reference \fIsymbol\fR. The user is
1603 expected to provide an object containing the \fB__wrap_\fR\fIsymbol\fR
1604 function. This wrapper function can call \fB__real_\fR\fIsymbol\fR in order to
1605 reference the actual function being wrapped.
1606 .sp
1607 The following is an example of a wrapper for the \fBmalloc\fR(3C) function:
1608 .sp
1609 .in +2
1610 .nf
1611 void *
1612 __wrap_malloc(size_t c)
1613 {
1614         (void) printf("malloc called with %zu\en", c);
1615         return (__real_malloc(c));
1616 }
1617 .fi
1618 .in -2
1619 
1620 If you link other code with this file using \fB-z\fR \fBwrap=malloc\fR to
1621 compile all the objects, then all calls to \fBmalloc\fR will call the function
1622 \fB__wrap_malloc\fR instead. The call to \fB__real_malloc\fR will call the real
1623 \fBmalloc\fR function.
1624 .sp
1625 The real and wrapped functions should be maintained in separate source files.
1626 Otherwise, the compiler or assembler may resolve the call instead of leaving
1627 that operation for the link-editor to carry out, and prevent the wrap from
1628 occurring.
1629 .RE
1630 
1631 .SH ENVIRONMENT VARIABLES
1632 .sp
1633 .ne 2
1634 .na
1635 \fB\fBLD_ALTEXEC\fR\fR
1636 .ad
1637 .sp .6
1638 .RS 4n
1639 An alternative link-editor path name. \fBld\fR executes, and passes control to
1640 this alternative link-editor. This environment variable provides a generic
1641 means of overriding the default link-editor that is called from the various
1642 compiler drivers. See the \fB-z altexec64\fR option.
1643 .RE
1644 
1645 .sp
1646 .ne 2
1647 .na
1648 \fB\fBLD_LIBRARY_PATH\fR\fR
1649 .ad
1650 .sp .6
1651 .RS 4n
1652 A list of directories in which to search for the libraries specified using the
1653 \fB-l\fR option. Multiple directories are separated by a colon. In the most
1654 general case, this environment variable contains two directory lists separated
1655 by a semicolon:
1656 .sp
1657 .in +2
1658 .nf
1659 \fIdirlist1\fR\fB;\fR\fIdirlist2\fR
1660 .fi
1661 .in -2
1662 .sp
1663 
1664 If \fBld\fR is called with any number of occurrences of \fB-L\fR, as in:
1665 .sp
1666 .in +2
1667 .nf
1668 \fBld ... -L\fIpath1\fR ... -L\fIpathn\fR ...\fR
1669 .fi
1670 .in -2
1671 .sp
1672 
1673 then the search path ordering is:
1674 .sp
1675 .in +2
1676 .nf
1677 \fB\fIdirlist1 path1\fR ... \fIpathn dirlist2\fR LIBPATH\fR
1678 .fi
1679 .in -2
1680 .sp
1681 
1682 When the list of directories does not contain a semicolon, the list is
1683 interpreted as \fIdirlist2\fR.
1684 .sp
1685 The \fBLD_LIBRARY_PATH\fR environment variable also affects the runtime linkers
1686 search for dynamic dependencies.
1687 .sp
1688 This environment variable can be specified with a _32 or _64 suffix. This makes
1689 the environment variable specific, respectively, to 32-bit or 64-bit processes
1690 and overrides any non-suffixed version of the environment variable that is in
1691 effect.
1692 .RE
1693 
1694 .sp
1695 .ne 2
1696 .na
1697 \fB\fBLD_NOEXEC_64\fR\fR
1698 .ad
1699 .sp .6
1700 .RS 4n
1701 Suppresses the automatic execution of the 64-bit link-editor. By default, the
1702 link-editor executes the 64-bit version when the \fBELF\fR class of the first
1703 relocatable file identifies a 64-bit object. The 64-bit image that a 32-bit
1704 link-editor can create, has some limitations. However, some link-edits might
1705 find the use of the 32-bit link-editor faster.
1706 .RE
1707 
1708 .sp
1709 .ne 2
1710 .na
1711 \fB\fBLD_OPTIONS\fR\fR
1712 .ad
1713 .sp .6
1714 .RS 4n
1715 A default set of options to \fBld\fR. \fBLD_OPTIONS\fR is interpreted by
1716 \fBld\fR just as though its value had been placed on the command line,
1717 immediately following the name used to invoke \fBld\fR, as in:
1718 .sp
1719 .in +2
1720 .nf
1721 \fBld $LD_OPTIONS ... \fIother-arguments\fR ...\fR
1722 .fi
1723 .in -2
1724 .sp
1725 
1726 .RE
1727 
1728 .sp
1729 .ne 2
1730 .na
1731 \fB\fBLD_RUN_PATH\fR\fR
1732 .ad
1733 .sp .6
1734 .RS 4n
1735 An alternative mechanism for specifying a runpath to the link-editor. See the
1736 \fB-R\fR option. If both \fBLD_RUN_PATH\fR and the \fB-R\fR option are
1737 specified, \fB-R\fR supersedes.
1738 .RE
1739 
1740 .sp
1741 .ne 2
1742 .na
1743 \fB\fBSGS_SUPPORT\fR\fR
1744 .ad
1745 .sp .6
1746 .RS 4n
1747 Provides a colon-separated list of shared objects that are loaded with the
1748 link-editor and given information regarding the linking process. This
1749 environment variable can be specified with a _32 or _64 suffix. This makes the
1750 environment variable specific, respectively, to the 32-bit or 64-bit class of
1751 \fBld\fR and overrides any non-suffixed version of the environment variable
1752 that is in effect. See the \fB-S\fR option.
1753 .RE
1754 
1755 .sp
1756 .LP
1757 Notice that environment variable-names that begin with the
1758 characters '\fBLD_\fR' are reserved for possible future enhancements to \fBld\fR and
1759 \fBld.so.1\fR(1).
1760 .SH FILES
1761 .sp
1762 .ne 2
1763 .na
1764 \fB\fBlib\fIx\fR.so\fR\fR
1765 .ad
1766 .RS 15n
1767 shared object libraries.
1768 .RE
1769 
1770 .sp
1771 .ne 2
1772 .na
1773 \fB\fBlib\fIx\fR.a\fR\fR
1774 .ad
1775 .RS 15n
1776 archive libraries.
1777 .RE
1778 
1779 .sp
1780 .ne 2
1781 .na
1782 \fB\fBa.out\fR\fR
1783 .ad
1784 .RS 15n
1785 default output file.
1786 .RE
1787 
1788 .sp
1789 .ne 2
1790 .na
1791 \fB\fILIBPATH\fR\fR
1792 .ad
1793 .RS 15n
1794 For 32-bit libraries, the default search path is \fB/usr/ccs/lib\fR, followed
1795 by \fB/lib\fR, and finally \fB/usr/lib\fR. For 64-bit libraries, the default
1796 search path is \fB/lib/64\fR, followed by \fB/usr/lib/64\fR.
1797 .RE
1798 
1799 .sp
1800 .ne 2
1801 .na
1802 \fB\fB/usr/lib/ld\fR\fR
1803 .ad
1804 .RS 15n
1805 A directory containing several \fBmapfiles\fR that can be used during
1806 link-editing. These \fBmapfiles\fR provide various capabilities, such as
1807 defining memory layouts, aligning bss, and defining non-executable stacks.
1808 .RE
1809 
1810 .SH ATTRIBUTES
1811 .sp
1812 .LP
1813 See \fBattributes\fR(5) for descriptions of the following attributes:
1814 .sp
1815 
1816 .sp
1817 .TS
1818 box;
1819 c | c
1820 l | l .
1821 ATTRIBUTE TYPE  ATTRIBUTE VALUE
1822 _
1823 Interface Stability     Committed
1824 .TE
1825 
1826 .SH SEE ALSO
1827 .sp
1828 .LP
1829 \fBas\fR(1), \fBcrle\fR(1), \fBgprof\fR(1), \fBld.so.1\fR(1), \fBldd\fR(1),
1830 \fBmcs\fR(1), \fBpvs\fR(1), \fBexec\fR(2), \fBstat\fR(2), \fBdlopen\fR(3C),
1831 \fBdldump\fR(3C), \fBelf\fR(3ELF), \fBar.h\fR(3HEAD), \fBa.out\fR(4),
1832 \fBattributes\fR(5)
1833 .sp
1834 .LP
1835 \fILinker and Libraries Guide\fR
1836 .SH NOTES
1837 .sp
1838 .LP
1839 Default options applied by \fBld\fR are maintained for historic reasons. In
1840 today's programming environment, where dynamic objects dominate, alternative
1841 defaults would often make more sense. However, historic defaults must be
1842 maintained to ensure compatibility with existing program development
1843 environments. Historic defaults are called out wherever possible in this
1844 manual. For a description of the current recommended options, see Appendix A,
1845 \fILink-Editor Quick Reference,\fR in \fILinker and Libraries Guide\fR.
1846 .sp
1847 .LP
1848 If the file being created by \fBld\fR already exists, the file is unlinked
1849 after all input files have been processed. A new file with the specified name
1850 is then created. This allows \fBld\fR to create a new version of the file,
1851 while simultaneously allowing existing processes that are accessing the old
1852 file contents to continue running. If the old file has no other links, the disk
1853 space of the removed file is freed when the last process referencing the file
1854 terminates.
1855 .sp
1856 .LP
1857 The behavior of \fBld\fR when the file being created already exists was changed
1858 with \fBSXCE\fR build \fB43\fR. In older versions, the existing file was
1859 rewritten in place, an approach with the potential to corrupt any running
1860 processes that is using the file. This change has an implication for output
1861 files that have multiple hard links in the file system. Previously, all links
1862 would remain intact, with all links accessing the new file contents. The new
1863 \fBld\fR behavior \fBbreaks\fR such links, with the result that only the
1864 specified output file name references the new file. All the other links
1865 continue to reference the old file. To ensure consistent behavior, applications
1866 that rely on multiple hard links to linker output files should explicitly
1867 remove and relink the other file names.