Print this page
7319 Need a way to turn off ld "multiple inclusion" warnings
Reviewed by: Martin Bochnig <opensxce@mail.ru>
Reviewed by: Kim Shrier <kshrier@racktopsystems.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
   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


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


   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 .\" Copyright 2016 RackTop Systems.
   6 .\" 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.
   7 .\"  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
   8 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   9 .TH LD 1 "Aug 24, 2016"
  10 .SH NAME
  11 ld \- link-editor for object files
  12 .SH SYNOPSIS
  13 .LP
  14 .nf
  15 \fBld\fR [\fB-32\fR | \fB-64\fR] [\fB-a\fR | \fB-r\fR] [\fB-b\fR] [\fB-B\fRdirect | nodirect]
  16 [\fB-B\fR dynamic | static] [\fB-B\fR eliminate] [\fB-B\fR group] [\fB-B\fR local]
  17 [\fB-B\fR reduce] [\fB-B\fR symbolic] [\fB-c\fR \fIname\fR] [\fB-C\fR] [\fB-d\fR y | n]
  18 [\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]
  19 [\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]
  20 [\fB-N\fR \fIstring\fR] [\fB-o\fR \fIoutfile\fR] [\fB-p\fR \fIauditlib\fR] [\fB-P\fR \fIauditlib\fR]
  21 [\fB-Q\fR y | n] [\fB-R\fR \fIpath\fR] [\fB-s\fR] [\fB-S\fR \fIsupportlib\fR] [\fB-t\fR]
  22 [\fB-u\fR \fIsymname\fR] [\fB-V\fR] [\fB-Y P\fR\fI,dirlist\fR] [\fB-z\fR absexec]
  23 [\fB-z\fR allextract | defaultextract | weakextract ] [\fB-z\fR altexec64]
  24 [\fB-z\fR assert-deflib ] [ \fB-z\fR assert-deflib=\fIlibname\fR ]
  25 [\fB-z\fR combreloc | nocombreloc ] [\fB-z\fR defs | nodefs]
  26 [\fB-z\fR direct | nodirect] [\fB-z\fR endfiltee]
  27 [\fB-z\fR fatal-warnings | nofatal-warnings ] [\fB-z\fR finiarray=\fIfunction\fR]
  28 [\fB-z\fR globalaudit] [\fB-z\fR groupperm | nogroupperm] 
  29 [\fB-z\fR guidance[=\fIid1\fR,\fIid2\fR...] [\fB-z\fR help ]
  30 [\fB-z\fR ignore | record] [\fB-z\fR initarray=\fIfunction\fR] [\fB-z\fR initfirst]
  31 [\fB-z\fR interpose] [\fB-z\fR lazyload | nolazyload]
  32 [\fB-z\fR ld32=\fIarg1\fR,\fIarg2\fR,...] [\fB-z\fR ld64=\fIarg1\fR,\fIarg2\fR,...]
  33 [\fB-z\fR loadfltr] [\fB-z\fR muldefs] [\fB-z\fR mulincl] [\fB-z\fR nocompstrtab] [\fB-z\fR nodefaultlib]
  34 [\fB-z\fR nodelete] [\fB-z\fR nodlopen] [\fB-z\fR nodump] [\fB-z\fR noldynsym]
  35 [\fB-z\fR nopartial] [\fB-z\fR noversion] [\fB-z\fR now] [\fB-z\fR origin]
  36 [\fB-z\fR preinitarray=\fIfunction\fR] [\fB-z\fR redlocsym] [\fB-z\fR relaxreloc]
  37 [\fB-z\fR rescan-now] [\fB-z\fR recan] [\fB-z\fR rescan-start \fI\&...\fR \fB-z\fR rescan-end]]
  38 [\fB-z\fR target=sparc|x86] [\fB-z\fR text | textwarn | textoff]
  39 [\fB-z\fR verbose] [\fB-z\fR wrap=\fIsymbol\fR] \fIfilename\fR...
  40 .fi
  41 
  42 .SH DESCRIPTION
  43 .sp
  44 .LP
  45 The link-editor, \fBld\fR, combines relocatable object files by resolving
  46 symbol references to symbol definitions, together with performing relocations.
  47 \fBld\fR operates in two modes, static or dynamic, as governed by the \fB-d\fR
  48 option. In all cases, the output of \fBld\fR is left in the file \fBa.out\fR by
  49 default. See NOTES.
  50 .sp
  51 .LP
  52 In dynamic mode, \fB-dy\fR, the default, relocatable object files that are
  53 provided as arguments are combined to produce an executable object file. This
  54 file is linked at execution with any shared object files that are provided as
  55 arguments. If the \fB-G\fR option is specified, relocatable object files are
  56 combined to produce a shared object. Without the \fB-G\fR option, a dynamic
  57 executable is created.
  58 .sp
  59 .LP
  60 In static mode, \fB-dn\fR, relocatable object files that are provided as
  61 arguments are combined to produce a static executable file. If the \fB-r\fR
  62 option is specified, relocatable object files are combined to produce one
  63 relocatable object file. See \fBStatic Executables\fR.
  64 .sp
  65 .LP
  66 Dynamic linking is the most common model for combining relocatable objects, and
  67 the eventual creation of processes within Solaris. This environment tightly
  68 couples the work of the link-editor and the runtime linker, \fBld.so.1\fR(1).
  69 Both of these utilities, together with their related technologies and
  70 utilities, are extensively documented in the \fILinker and Libraries Guide\fR.
  71 .sp
  72 .LP
  73 If any argument is a library, \fBld\fR by default searches the library exactly
  74 once at the point the library is first encountered on the argument list. The
  75 library can be either a shared object or relocatable archive. See
  76 \fBar.h\fR(3HEAD)).
  77 .sp
  78 .LP
  79 A shared object consists of an indivisible, whole unit that has been generated
  80 by a previous link-edit of one or more input files. When the link-editor
  81 processes a shared object, the entire contents of the shared object become a
  82 logical part of the resulting output file image. The shared object is not
  83 physically copied during the link-edit as its actual inclusion is deferred
  84 until process execution. This logical inclusion means that all symbol entries
  85 defined in the shared object are made available to the link-editing process.
  86 See Chapter 4, \fIShared Objects,\fR in \fILinker and Libraries Guide\fR
  87 .sp
  88 .LP
  89 For an archive library, \fBld\fR loads only those routines that define an
  90 unresolved external reference. \fBld\fR searches the symbol table of the
  91 archive library sequentially to resolve external references that can be
  92 satisfied by library members. This search is repeated until no external
  93 references can be resolved by the archive. Thus, the order of members in the
  94 library is functionally unimportant, unless multiple library members exist that
  95 define the same external symbol. Archive libraries that have interdependencies
  96 can require multiple command line definitions, or the use of one of the


1249 bound to the filter. The runtime processing of an object that contains this
1250 flag mimics that which occurs if the \fBLD_LOADFLTR\fR environment variable is
1251 in effect. See the \fBld.so.1\fR(1).
1252 .RE
1253 
1254 .sp
1255 .ne 2
1256 .na
1257 \fB\fB-z\fR \fBmuldefs\fR\fR
1258 .ad
1259 .br
1260 .na
1261 \fB\fB--allow-multiple-definition\fR\fR
1262 .ad
1263 .sp .6
1264 .RS 4n
1265 Allows multiple symbol definitions. By default, multiple symbol definitions
1266 that occur between relocatable objects result in a fatal error condition. This
1267 option, suppresses the error condition, allowing the first symbol definition to
1268 be taken.
1269 .RE
1270 
1271 .sp
1272 .ne 2
1273 .na
1274 \fB\fB-z\fR \fBmulincl\fR\fR
1275 .ad
1276 .sp .6
1277 .RS 4n
1278 Allows multiple inclusion of the same file. By default, a warning is generated
1279 for libraries that are passed multiple times on the command line.  This option
1280 suppresses that warning, allowing \fB-z\fR \fBfatal-warnings\fR to be used when
1281 compiling code that makes multiple inclusions.  \fBNote:\fR When a file is
1282 specified more than once, only the first instance is included.
1283 .RE
1284 
1285 .sp
1286 .ne 2
1287 .na
1288 \fB\fB-z\fR \fBnocompstrtab\fR\fR
1289 .ad
1290 .sp .6
1291 .RS 4n
1292 Disables the compression of \fBELF\fR string tables. By default, string
1293 compression is applied to \fBSHT_STRTAB\fR sections, and to \fBSHT_PROGBITS\fR
1294 sections that have their \fBSHF_MERGE\fR and \fBSHF_STRINGS\fR section flags
1295 set.
1296 .RE
1297 
1298 .sp
1299 .ne 2
1300 .na
1301 \fB\fB-z\fR \fBnodefaultlib\fR\fR
1302 .ad