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 .br
1130 .na
1131 \fB\fB--as-needed\fR | \fB--no-as-needed\fR\fR
1132 .ad
1133 .sp .6
1134 .RS 4n
1135 Ignores, or records, dynamic dependencies that are not referenced as part of
1136 the link-edit. Ignores, or records, unreferenced \fBELF\fR sections from the
1137 relocatable objects that are read as part of the link-edit. By default,
1138 \fB-z\fR \fBrecord\fR is in effect.
1139 .sp
1140 If an \fBELF\fR section is ignored, the section is eliminated from the output
1141 file being generated. A section is ignored when three conditions are true. The
1142 eliminated section must contribute to an allocatable segment. The eliminated
1143 section must provide no global symbols. No other section from any object that
1144 contributes to the link-edit, must reference an eliminated section.
1145 .RE
1146 
1147 .sp
1148 .ne 2
1149 .na
1150 \fB\fB-z\fR \fBinitarray=\fR\fIfunction\fR\fR
1151 .ad
1152 .sp .6
1153 .RS 4n
1154 Appends an entry to the \fB\&.initarray\fR section of the object being built.
1155 If no \fB\&.initarray\fR section is present, a section is created. The new
1156 entry is initialized to point to \fIfunction\fR. See \fIInitialization and
1157 Termination Sections\fR in \fILinker and Libraries Guide\fR.
1158 .RE
1159 
1160 .sp
1161 .ne 2
1162 .na
1163 \fB\fB-z\fR \fBinitfirst\fR\fR
1164 .ad
1165 .sp .6
1166 .RS 4n
1167 Marks the object so that its runtime initialization occurs before the runtime
1168 initialization of any other objects brought into the process at the same time.
1169 In addition, the object runtime finalization occurs after the runtime
1170 finalization of any other objects removed from the process at the same time.
1171 This option is only meaningful when building a shared object.
1172 .RE
1173 
1174 .sp
1175 .ne 2
1176 .na
1177 \fB\fB-z\fR \fBinterpose\fR\fR
1178 .ad
1179 .sp .6
1180 .RS 4n
1181 Marks the object as an interposer. At runtime, an object is identified as an
1182 explicit interposer if the object has been tagged using the \fB-z interpose\fR
1183 option. An explicit interposer is also established when an object is loaded
1184 using the \fBLD_PRELOAD\fR environment variable. Implicit interposition can
1185 occur because of the load order of objects, however, this implicit
1186 interposition is unknown to the runtime linker. Explicit interposition can
1187 ensure that interposition takes place regardless of the order in which objects
1188 are loaded. Explicit interposition also ensures that the runtime linker
1189 searches for symbols in any explicit interposers when direct bindings are in
1190 effect.
1191 .RE
1192 
1193 .sp
1194 .ne 2
1195 .na
1196 \fB\fB-z\fR \fBlazyload\fR | \fBnolazyload\fR\fR
1197 .ad
1198 .sp .6
1199 .RS 4n
1200 Enables or disables the marking of dynamic dependencies to be lazily loaded.
1201 Dynamic dependencies which are marked \fBlazyload\fR are not loaded at initial
1202 process start-up. These dependencies are delayed until the first binding to the
1203 object is made. \fBNote:\fR Lazy loading requires the correct declaration of
1204 dependencies, together with associated runpaths for each dynamic object used
1205 within a process. See \fILazy Loading of Dynamic Dependencies\fR in \fILinker
1206 and Libraries Guide\fR.
1207 .RE
1208 
1209 .sp
1210 .ne 2
1211 .na
1212 \fB\fB-z\fR \fBld32\fR=\fIarg1\fR,\fIarg2\fR,...\fR
1213 .ad
1214 .br
1215 .na
1216 \fB\fB-z\fR \fBld64\fR=\fIarg1\fR,\fIarg2\fR,...\fR
1217 .ad
1218 .sp .6
1219 .RS 4n
1220 The class of the link-editor is affected by the class of the output file being
1221 created and by the capabilities of the underlying operating system. The
1222 \fB-z\fR \fBld\fR[\fB32\fR|\fB64\fR] options provide a means of defining any
1223 link-editor argument. The defined argument is only interpreted, respectively,
1224 by the 32-bit class or 64-bit class of the link-editor.
1225 .sp
1226 For example, support libraries are class specific, so the correct class of
1227 support library can be ensured using:
1228 .sp
1229 .in +2
1230 .nf
1231 \fBld ... -z ld32=-Saudit32.so.1 -z ld64=-Saudit64.so.1 ...\fR
1232 .fi
1233 .in -2
1234 .sp
1235 
1236 The class of link-editor that is invoked is determined from the \fBELF\fR class
1237 of the first relocatable file that is seen on the command line. This
1238 determination is carried out \fBprior\fR to any \fB-z\fR
1239 \fBld\fR[\fB32\fR|\fB64\fR] processing.
1240 .RE
1241 
1242 .sp
1243 .ne 2
1244 .na
1245 \fB\fB-z\fR \fBloadfltr\fR\fR
1246 .ad
1247 .sp .6
1248 .RS 4n
1249 Marks a filter to indicate that filtees must be processed immediately at
1250 runtime. Normally, filter processing is delayed until a symbol reference is
1251 bound to the filter. The runtime processing of an object that contains this
1252 flag mimics that which occurs if the \fBLD_LOADFLTR\fR environment variable is
1253 in effect. See the \fBld.so.1\fR(1).
1254 .RE
1255 
1256 .sp
1257 .ne 2
1258 .na
1259 \fB\fB-z\fR \fBmuldefs\fR\fR
1260 .ad
1261 .br
1262 .na
1263 \fB\fB--allow-multiple-definition\fR\fR
1264 .ad
1265 .sp .6
1266 .RS 4n
1267 Allows multiple symbol definitions. By default, multiple symbol definitions
1268 that occur between relocatable objects result in a fatal error condition. This
1269 option, suppresses the error condition, allowing the first symbol definition to
1270 be taken.
1271 .RE
1272 
1273 .sp
1274 .ne 2
1275 .na
1276 \fB\fB-z\fR \fBnocompstrtab\fR\fR
1277 .ad
1278 .sp .6
1279 .RS 4n
1280 Disables the compression of \fBELF\fR string tables. By default, string
1281 compression is applied to \fBSHT_STRTAB\fR sections, and to \fBSHT_PROGBITS\fR
1282 sections that have their \fBSHF_MERGE\fR and \fBSHF_STRINGS\fR section flags
1283 set.
1284 .RE
1285 
1286 .sp
1287 .ne 2
1288 .na
1289 \fB\fB-z\fR \fBnodefaultlib\fR\fR
1290 .ad
1291 .sp .6
1292 .RS 4n
1293 Marks the object so that the runtime default library search path, used after
1294 any \fBLD_LIBRARY_PATH\fR or runpaths, is ignored. This option implies that all
1295 dependencies of the object can be satisfied from its runpath.
1296 .RE
1297 
1298 .sp
1299 .ne 2
1300 .na
1301 \fB\fB-z\fR \fBnodelete\fR\fR
1302 .ad
1303 .sp .6
1304 .RS 4n
1305 Marks the object as non-deletable at runtime. This mode is similar to adding
1306 the object to the process by using \fBdlopen\fR(3C) with the
1307 \fBRTLD_NODELETE\fR mode.
1308 .RE
1309 
1310 .sp
1311 .ne 2
1312 .na
1313 \fB\fB-z\fR \fBnodlopen\fR\fR
1314 .ad
1315 .sp .6
1316 .RS 4n
1317 Marks the object as not available to \fBdlopen\fR(3C), either as the object
1318 specified by the \fBdlopen()\fR, or as any form of dependency required by the
1319 object specified by the \fBdlopen()\fR. This option is only meaningful when
1320 building a shared object.
1321 .RE
1322 
1323 .sp
1324 .ne 2
1325 .na
1326 \fB\fB-z\fR \fBnodump\fR\fR
1327 .ad
1328 .sp .6
1329 .RS 4n
1330 Marks the object as not available to \fBdldump\fR(3C).
1331 .RE
1332 
1333 .sp
1334 .ne 2
1335 .na
1336 \fB\fB-z\fR \fBnoldynsym\fR\fR
1337 .ad
1338 .sp .6
1339 .RS 4n
1340 Prevents the inclusion of a \fB\&.SUNW_ldynsym\fR section in dynamic
1341 executables or sharable libraries. The \fB\&.SUNW_ldynsym\fR section augments
1342 the \fB\&.dynsym\fR section by providing symbols for local functions. Local
1343 function symbols allow debuggers to display local function names in stack
1344 traces from stripped programs. Similarly, \fBdladdr\fR(3C) is able to supply
1345 more accurate results.
1346 .sp
1347 The \fB-z\fR \fBnoldynsym\fR option also prevents the inclusion of the two
1348 symbol sort sections that are related to the \fB\&.SUNW_ldynsym\fR section. The
1349 \fB\&.SUNW_dynsymsort\fR section provides sorted access to regular function and
1350 variable symbols. The \fB\&.SUNW_dyntlssort\fR section provides sorted access
1351 to thread local storage (\fBTLS\fR) variable symbols.
1352 .sp
1353 The \fB\&.SUNW_ldynsym\fR, \fB\&.SUNW_dynsymsort\fR, and
1354 \fB\&.SUNW_dyntlssort\fR sections, which becomes part of the allocable text
1355 segment of the resulting file, cannot be removed by \fBstrip\fR(1). Therefore,
1356 the \fB-z\fR \fBnoldynsym\fR option is the only way to prevent their inclusion.
1357 See the \fB-s\fR and \fB-z\fR \fBredlocsym\fR options.
1358 .RE
1359 
1360 .sp
1361 .ne 2
1362 .na
1363 \fB\fB-z\fR \fBnopartial\fR\fR
1364 .ad
1365 .sp .6
1366 .RS 4n
1367 Partially initialized symbols, that are defined within relocatable object
1368 files, are expanded in the output file being generated.
1369 .RE
1370 
1371 .sp
1372 .ne 2
1373 .na
1374 \fB\fB-z\fR \fBnoversion\fR\fR
1375 .ad
1376 .sp .6
1377 .RS 4n
1378 Does not record any versioning sections. Any version sections or associated
1379 \fB\&.dynamic\fR section entries are not generated in the output image.
1380 .RE
1381 
1382 .sp
1383 .ne 2
1384 .na
1385 \fB\fB-z\fR \fBnow\fR\fR
1386 .ad
1387 .sp .6
1388 .RS 4n
1389 Marks the object as requiring non-lazy runtime binding. This mode is similar to
1390 adding the object to the process by using \fBdlopen\fR(3C) with the
1391 \fBRTLD_NOW\fR mode. This mode is also similar to having the \fBLD_BIND_NOW\fR
1392 environment variable in effect. See \fBld.so.1\fR(1).
1393 .RE
1394 
1395 .sp
1396 .ne 2
1397 .na
1398 \fB\fB-z\fR \fBorigin\fR\fR
1399 .ad
1400 .sp .6
1401 .RS 4n
1402 Marks the object as requiring immediate \fB$ORIGIN\fR processing at runtime.
1403 This option is only maintained for historic compatibility, as the runtime
1404 analysis of objects to provide for \fB$ORIGIN\fR processing is now default.
1405 .RE
1406 
1407 .sp
1408 .ne 2
1409 .na
1410 \fB\fB-z\fR \fBpreinitarray=\fR\fIfunction\fR\fR
1411 .ad
1412 .sp .6
1413 .RS 4n
1414 Appends an entry to the \fB\&.preinitarray\fR section of the object being
1415 built. If no \fB\&.preinitarray\fR section is present, a section is created.
1416 The new entry is initialized to point to \fIfunction\fR. See \fIInitialization
1417 and Termination Sections\fR in \fILinker and Libraries Guide\fR.
1418 .RE
1419 
1420 .sp
1421 .ne 2
1422 .na
1423 \fB\fB-z\fR \fBredlocsym\fR\fR
1424 .ad
1425 .sp .6
1426 .RS 4n
1427 Eliminates all local symbols except for the \fISECT\fR symbols from the symbol
1428 table \fBSHT_SYMTAB\fR. All relocations that refer to local symbols are updated
1429 to refer to the corresponding \fISECT\fR symbol. This option allows specialized
1430 objects to greatly reduce their symbol table sizes. Eliminated local symbols
1431 can reduce the \fB\&.stab*\fR debugging information that is generated using the
1432 compiler drivers \fB-g\fR option. See the \fB-s\fR and \fB-z\fR \fBnoldynsym\fR
1433 options.
1434 .RE
1435 
1436 .sp
1437 .ne 2
1438 .na
1439 \fB\fB-z\fR \fBrelaxreloc\fR\fR
1440 .ad
1441 .sp .6
1442 .RS 4n
1443 \fBld\fR normally issues a fatal error upon encountering a relocation using a
1444 symbol that references an eliminated COMDAT section. If \fB-z\fR
1445 \fBrelaxreloc\fR is enabled, \fBld\fR instead redirects such relocations to the
1446 equivalent symbol in the COMDAT section that was kept. \fB-z\fR
1447 \fBrelaxreloc\fR is a specialized option, mainly of interest to compiler
1448 authors, and is not intended for general use.
1449 .RE
1450 
1451 .sp
1452 .ne 2
1453 .na
1454 \fB\fB-z\fR \fBrescan-now\fR\fR
1455 .ad
1456 .br
1457 .na
1458 \fB\fB-z\fR \fBrescan\fR\fR
1459 .ad
1460 .sp .6
1461 .RS 4n
1462 These options rescan the archive files that are provided to the link-edit. By
1463 default, archives are processed once as the archives appear on the command
1464 line. Archives are traditionally specified at the end of the command line so
1465 that their symbol definitions resolve any preceding references. However,
1466 specifying archives multiple times to satisfy their own interdependencies can
1467 be necessary.
1468 .sp
1469 \fB-z\fR \fBrescan-now\fR is a positional option, and is processed by the
1470 link-editor immediately when encountered on the command line. All archives seen
1471 on the command line up to that point are immediately reprocessed in an attempt
1472 to locate additional archive members that resolve symbol references. This
1473 archive rescanning is repeated until a pass over the archives occurs in which
1474 no new members are extracted.
1475 .sp
1476 \fB-z\fR \fBrescan\fR is a position independent option. The link-editor defers
1477 the rescan operation until after it has processed the entire command line, and
1478 then initiates a final rescan operation over all archives seen on the command
1479 line. The \fB-z\fR \fBrescan\fR operation can interact          incorrectly
1480 with objects that contain initialization (.init) or finalization (.fini)
1481 sections, preventing the code in those sections from running. For this reason,
1482 \fB-z\fR \fBrescan\fR is deprecated, and use of \fB-z\fR \fBrescan-now\fR is
1483 advised.
1484 .RE
1485 
1486 .sp
1487 .ne 2
1488 .na
1489 \fB\fB-z\fR \fBrescan-start\fR ... \fB-z\fR \fBrescan-end\fR\fR
1490 .ad
1491 .br
1492 .na
1493 \fB\fB--start-group\fR ... \fB--end-group\fR\fR
1494 .ad
1495 .br
1496 .na
1497 \fB\fB-(\fR ... \fB-)\fR\fR
1498 .ad
1499 .sp .6
1500 .RS 4n
1501 Defines an archive rescan group. This is a positional construct, and is
1502 processed by the link-editor immediately upon encountering the closing
1503 delimiter option.  Archives found within the group delimiter options are
1504 reprocessed as a group in an attempt to locate  additional archive members that
1505 resolve symbol references. This archive rescanning  is repeated  until a  pass
1506 over the archives On the occurs in  which no  new  members are extracted.
1507 Archive rescan groups cannot be nested.
1508 .RE
1509 
1510 .sp
1511 .ne 2
1512 .na
1513 \fB\fB-z\fR \fBtarget=sparc|x86\fR \fI\fR\fR
1514 .ad
1515 .sp .6
1516 .RS 4n
1517 Specifies the machine type for the output object. Supported targets are Sparc
1518 and x86. The 32-bit machine type for the specified target is used unless the
1519 \fB-64\fR option is also present, in which case the corresponding 64-bit
1520 machine type is used. By default, the machine type of the object being
1521 generated is determined from the first \fBELF\fR object processed from the
1522 command line. If no objects are specified, the machine type is determined by
1523 the first object encountered within the first archive processed from the
1524 command line. If there are no objects or archives, the link-editor assumes the
1525 native machine. This option is useful when creating an object directly with
1526 \fBld\fR whose input is solely from a \fBmapfile\fR. See the \fB-M\fR option.
1527 It can also be useful in the rare case of linking entirely from an archive that
1528 contains objects of different machine types for which the first object is not
1529 of the desired machine type. See \fIThe 32-bit link-editor and 64-bit
1530 link-editor\fR in \fILinker and Libraries Guide\fR.
1531 .RE
1532 
1533 .sp
1534 .ne 2
1535 .na
1536 \fB\fB-z\fR \fBtext\fR\fR
1537 .ad
1538 .sp .6
1539 .RS 4n
1540 In dynamic mode only, forces a fatal error if any relocations against
1541 non-writable, allocatable sections remain. For historic reasons, this mode is
1542 not the default when building an executable or shared object. However, its use
1543 is recommended to ensure that the text segment of the dynamic object being
1544 built is shareable between multiple running processes. A shared text segment
1545 incurs the least relocation overhead when loaded into memory. See
1546 \fIPosition-Independent Code\fR in \fILinker and Libraries Guide\fR.
1547 .RE
1548 
1549 .sp
1550 .ne 2
1551 .na
1552 \fB\fB-z\fR \fBtextoff\fR\fR
1553 .ad
1554 .sp .6
1555 .RS 4n
1556 In dynamic mode only, allows relocations against all allocatable sections,
1557 including non-writable ones. This mode is the default when building a shared
1558 object.
1559 .RE
1560 
1561 .sp
1562 .ne 2
1563 .na
1564 \fB\fB-z\fR \fBtextwarn\fR\fR
1565 .ad
1566 .sp .6
1567 .RS 4n
1568 In dynamic mode only, lists a warning if any relocations against non-writable,
1569 allocatable sections remain. This mode is the default when building an
1570 executable.
1571 .RE
1572 
1573 .sp
1574 .ne 2
1575 .na
1576 \fB\fB-z\fR \fBverbose\fR\fR
1577 .ad
1578 .sp .6
1579 .RS 4n
1580 This option provides additional warning diagnostics during a link-edit.
1581 Presently, this option conveys suspicious use of displacement relocations. This
1582 option also conveys the restricted use of static \fBTLS\fR relocations when
1583 building shared objects. In future, this option might be enhanced to provide
1584 additional diagnostics that are deemed too noisy to be generated by default.
1585 .RE
1586 
1587 .sp
1588 .ne 2
1589 .na
1590 \fB\fB-z\fR\fBwrap=\fR\fIsymbol\fR\fR
1591 .ad
1592 .br
1593 .na
1594 \fB\fB-wrap=\fR \fIsymbol\fR\fR
1595 .ad
1596 .br
1597 .na
1598 \fB\fB--wrap=\fR \fIsymbol\fR\fR
1599 .ad
1600 .sp .6
1601 .RS 4n
1602 Rename undefined references to \fIsymbol\fR in order to allow wrapper code to
1603 be linked into the output object without having to modify source code. When
1604 \fB-z wrap\fR is specified, all undefined references to \fIsymbol\fR are
1605 modified to reference \fB__wrap_\fR\fIsymbol\fR, and all references to
1606 \fB__real_\fR\fIsymbol\fR are modified to reference \fIsymbol\fR. The user is
1607 expected to provide an object containing the \fB__wrap_\fR\fIsymbol\fR
1608 function. This wrapper function can call \fB__real_\fR\fIsymbol\fR in order to
1609 reference the actual function being wrapped.
1610 .sp
1611 The following is an example of a wrapper for the \fBmalloc\fR(3C) function:
1612 .sp
1613 .in +2
1614 .nf
1615 void *
1616 __wrap_malloc(size_t c)
1617 {
1618         (void) printf("malloc called with %zu\en", c);
1619         return (__real_malloc(c));
1620 }
1621 .fi
1622 .in -2
1623 
1624 If you link other code with this file using \fB-z\fR \fBwrap=malloc\fR to
1625 compile all the objects, then all calls to \fBmalloc\fR will call the function
1626 \fB__wrap_malloc\fR instead. The call to \fB__real_malloc\fR will call the real
1627 \fBmalloc\fR function.
1628 .sp
1629 The real and wrapped functions should be maintained in separate source files.
1630 Otherwise, the compiler or assembler may resolve the call instead of leaving
1631 that operation for the link-editor to carry out, and prevent the wrap from
1632 occurring.
1633 .RE
1634 
1635 .SH ENVIRONMENT VARIABLES
1636 .sp
1637 .ne 2
1638 .na
1639 \fB\fBLD_ALTEXEC\fR\fR
1640 .ad
1641 .sp .6
1642 .RS 4n
1643 An alternative link-editor path name. \fBld\fR executes, and passes control to
1644 this alternative link-editor. This environment variable provides a generic
1645 means of overriding the default link-editor that is called from the various
1646 compiler drivers. See the \fB-z altexec64\fR option.
1647 .RE
1648 
1649 .sp
1650 .ne 2
1651 .na
1652 \fB\fBLD_LIBRARY_PATH\fR\fR
1653 .ad
1654 .sp .6
1655 .RS 4n
1656 A list of directories in which to search for the libraries specified using the
1657 \fB-l\fR option. Multiple directories are separated by a colon. In the most
1658 general case, this environment variable contains two directory lists separated
1659 by a semicolon:
1660 .sp
1661 .in +2
1662 .nf
1663 \fIdirlist1\fR\fB;\fR\fIdirlist2\fR
1664 .fi
1665 .in -2
1666 .sp
1667 
1668 If \fBld\fR is called with any number of occurrences of \fB-L\fR, as in:
1669 .sp
1670 .in +2
1671 .nf
1672 \fBld ... -L\fIpath1\fR ... -L\fIpathn\fR ...\fR
1673 .fi
1674 .in -2
1675 .sp
1676 
1677 then the search path ordering is:
1678 .sp
1679 .in +2
1680 .nf
1681 \fB\fIdirlist1 path1\fR ... \fIpathn dirlist2\fR LIBPATH\fR
1682 .fi
1683 .in -2
1684 .sp
1685 
1686 When the list of directories does not contain a semicolon, the list is
1687 interpreted as \fIdirlist2\fR.
1688 .sp
1689 The \fBLD_LIBRARY_PATH\fR environment variable also affects the runtime linkers
1690 search for dynamic dependencies.
1691 .sp
1692 This environment variable can be specified with a _32 or _64 suffix. This makes
1693 the environment variable specific, respectively, to 32-bit or 64-bit processes
1694 and overrides any non-suffixed version of the environment variable that is in
1695 effect.
1696 .RE
1697 
1698 .sp
1699 .ne 2
1700 .na
1701 \fB\fBLD_NOEXEC_64\fR\fR
1702 .ad
1703 .sp .6
1704 .RS 4n
1705 Suppresses the automatic execution of the 64-bit link-editor. By default, the
1706 link-editor executes the 64-bit version when the \fBELF\fR class of the first
1707 relocatable file identifies a 64-bit object. The 64-bit image that a 32-bit
1708 link-editor can create, has some limitations. However, some link-edits might
1709 find the use of the 32-bit link-editor faster.
1710 .RE
1711 
1712 .sp
1713 .ne 2
1714 .na
1715 \fB\fBLD_OPTIONS\fR\fR
1716 .ad
1717 .sp .6
1718 .RS 4n
1719 A default set of options to \fBld\fR. \fBLD_OPTIONS\fR is interpreted by
1720 \fBld\fR just as though its value had been placed on the command line,
1721 immediately following the name used to invoke \fBld\fR, as in:
1722 .sp
1723 .in +2
1724 .nf
1725 \fBld $LD_OPTIONS ... \fIother-arguments\fR ...\fR
1726 .fi
1727 .in -2
1728 .sp
1729 
1730 .RE
1731 
1732 .sp
1733 .ne 2
1734 .na
1735 \fB\fBLD_RUN_PATH\fR\fR
1736 .ad
1737 .sp .6
1738 .RS 4n
1739 An alternative mechanism for specifying a runpath to the link-editor. See the
1740 \fB-R\fR option. If both \fBLD_RUN_PATH\fR and the \fB-R\fR option are
1741 specified, \fB-R\fR supersedes.
1742 .RE
1743 
1744 .sp
1745 .ne 2
1746 .na
1747 \fB\fBSGS_SUPPORT\fR\fR
1748 .ad
1749 .sp .6
1750 .RS 4n
1751 Provides a colon-separated list of shared objects that are loaded with the
1752 link-editor and given information regarding the linking process. This
1753 environment variable can be specified with a _32 or _64 suffix. This makes the
1754 environment variable specific, respectively, to the 32-bit or 64-bit class of
1755 \fBld\fR and overrides any non-suffixed version of the environment variable
1756 that is in effect. See the \fB-S\fR option.
1757 .RE
1758 
1759 .sp
1760 .LP
1761 Notice that environment variable-names that begin with the
1762 characters '\fBLD_\fR' are reserved for possible future enhancements to \fBld\fR and
1763 \fBld.so.1\fR(1).
1764 .SH FILES
1765 .sp
1766 .ne 2
1767 .na
1768 \fB\fBlib\fIx\fR.so\fR\fR
1769 .ad
1770 .RS 15n
1771 shared object libraries.
1772 .RE
1773 
1774 .sp
1775 .ne 2
1776 .na
1777 \fB\fBlib\fIx\fR.a\fR\fR
1778 .ad
1779 .RS 15n
1780 archive libraries.
1781 .RE
1782 
1783 .sp
1784 .ne 2
1785 .na
1786 \fB\fBa.out\fR\fR
1787 .ad
1788 .RS 15n
1789 default output file.
1790 .RE
1791 
1792 .sp
1793 .ne 2
1794 .na
1795 \fB\fILIBPATH\fR\fR
1796 .ad
1797 .RS 15n
1798 For 32-bit libraries, the default search path is \fB/usr/ccs/lib\fR, followed
1799 by \fB/lib\fR, and finally \fB/usr/lib\fR. For 64-bit libraries, the default
1800 search path is \fB/lib/64\fR, followed by \fB/usr/lib/64\fR.
1801 .RE
1802 
1803 .sp
1804 .ne 2
1805 .na
1806 \fB\fB/usr/lib/ld\fR\fR
1807 .ad
1808 .RS 15n
1809 A directory containing several \fBmapfiles\fR that can be used during
1810 link-editing. These \fBmapfiles\fR provide various capabilities, such as
1811 defining memory layouts, aligning bss, and defining non-executable stacks.
1812 .RE
1813 
1814 .SH ATTRIBUTES
1815 .sp
1816 .LP
1817 See \fBattributes\fR(5) for descriptions of the following attributes:
1818 .sp
1819 
1820 .sp
1821 .TS
1822 box;
1823 c | c
1824 l | l .
1825 ATTRIBUTE TYPE  ATTRIBUTE VALUE
1826 _
1827 Interface Stability     Committed
1828 .TE
1829 
1830 .SH SEE ALSO
1831 .sp
1832 .LP
1833 \fBas\fR(1), \fBcrle\fR(1), \fBgprof\fR(1), \fBld.so.1\fR(1), \fBldd\fR(1),
1834 \fBmcs\fR(1), \fBpvs\fR(1), \fBexec\fR(2), \fBstat\fR(2), \fBdlopen\fR(3C),
1835 \fBdldump\fR(3C), \fBelf\fR(3ELF), \fBar.h\fR(3HEAD), \fBa.out\fR(4),
1836 \fBattributes\fR(5)
1837 .sp
1838 .LP
1839 \fILinker and Libraries Guide\fR
1840 .SH NOTES
1841 .sp
1842 .LP
1843 Default options applied by \fBld\fR are maintained for historic reasons. In
1844 today's programming environment, where dynamic objects dominate, alternative
1845 defaults would often make more sense. However, historic defaults must be
1846 maintained to ensure compatibility with existing program development
1847 environments. Historic defaults are called out wherever possible in this
1848 manual. For a description of the current recommended options, see Appendix A,
1849 \fILink-Editor Quick Reference,\fR in \fILinker and Libraries Guide\fR.
1850 .sp
1851 .LP
1852 If the file being created by \fBld\fR already exists, the file is unlinked
1853 after all input files have been processed. A new file with the specified name
1854 is then created. This allows \fBld\fR to create a new version of the file,
1855 while simultaneously allowing existing processes that are accessing the old
1856 file contents to continue running. If the old file has no other links, the disk
1857 space of the removed file is freed when the last process referencing the file
1858 terminates.
1859 .sp
1860 .LP
1861 The behavior of \fBld\fR when the file being created already exists was changed
1862 with \fBSXCE\fR build \fB43\fR. In older versions, the existing file was
1863 rewritten in place, an approach with the potential to corrupt any running
1864 processes that is using the file. This change has an implication for output
1865 files that have multiple hard links in the file system. Previously, all links
1866 would remain intact, with all links accessing the new file contents. The new
1867 \fBld\fR behavior \fBbreaks\fR such links, with the result that only the
1868 specified output file name references the new file. All the other links
1869 continue to reference the old file. To ensure consistent behavior, applications
1870 that rely on multiple hard links to linker output files should explicitly
1871 remove and relink the other file names.