eld Input and Output
eld Manual—527255-009
2-16
Using Archives
The rules above, about finding the same DLL name more than once, also apply to the
special DLL name “__IMPLICIT_LIB__”.
Using Archives
An archive is a file that contains copies of linkfiles. The linker looks for files within the
archive to be used by the link. Linkfiles in the archive are used if they define global
symbols that are currently known about, but undefined, at this point in the command
stream. In each case, once the linker decides to use a file from the archive, that entire
file is used the same way it would be used if it had been specified directly in the
command stream.
It can be meaningful to specify the same archive more than once in the command
stream, because each time the linker opens the archive it only looks for linkfiles that
resolve symbols that are needed at that point.
When a linkfile is brought in from an archive, that can lead to additional needed
symbols. The archive is searched repeatedly to find such symbols. However, once the
linker has moved on to the next token in the command stream, this archive will not be
looked at again unless it is specified again in the command stream.
The
-u
option is used to specify the name of a symbol for which
eld
should look in
archives in the command stream, if
eld
had not already seen a definition of this
symbol before the archive was encountered. Note that this is similar to having a
hypothetical linkfile at the start of the command line that declared such a symbol
without defining it. However, one difference is that, when a symbol really does get
declared in a linkfile, that declaration tells if the symbol is globalized or not, but the
-u
option does not imply anything about whether the symbol is globalized.
The
-all
option tells the linker to unconditionally use all linkfiles found in archives,
rather than only using those that provide needed symbols. The
-none
option turns
this off, so that files found in archives are used only if they provide needed symbols as
described above. These options form a two-way switch, selecting one of two modes for
the linker at a given point in the command stream. These options can be specified
multiple times in the command stream, each time setting the mode for subsequent
items in the command stream until the mode is changed again. At the beginning of the
command stream the mode is
-none
. One use of
-all
is to convert an archive into a
DLL by telling the linker to build a DLL that contains all the same files as are present in
the given archive.
The option
-include_whole
is accepted as a synonym for
-all
, and
-no_include_whole
as a synonym for
-none
.
In general, users having 32-bit and 64-bit versions of their code are recommended to
maintain two separate versions to avoid confusion. For the archives, it is
recommended that the users do not mix up the
32-bit
and
64-bit
object files in the
same archive. Typically, a user has two archives with similar contents, one for the
32-
bit
and the other for the
64-bit
case. If the user links on to the OSS, two archives
can have the same name but, if the
32-bit
archive is placed into
/lib
,
/usr/lib
,
or
/usr/local/lib
, while the
64-bit
archive is placed into
/lib64
,
/usr/lib64
,
Summary of Contents for eld
Page 4: ......
Page 8: ...Contents eld Manual 527255 009 iv ...
Page 12: ...What s New in This Manual eld Manual 527255 009 viii Changes to the 527255 005 Manual ...
Page 34: ...Introduction to eld eld Manual 527255 009 1 14 Example of Use ...
Page 54: ...eld Input and Output eld Manual 527255 009 2 20 Using Archives ...
Page 98: ...Other eld Processing eld Manual 527255 009 4 20 Merging Source RTDUs ...
Page 242: ...Output Listings and Error Handling eld Manual 527255 009 6 132 Glossary of Errors ...