![]() |
![]() |
| ||||
|
Note - This listing is an example, and shows the options meaningful to the link-editor. The exact options might differ from release to release. Most compiler drivers interpret the -D option during their preprocessing phase. Therefore, the LD_OPTIONS environment variable is a suitable mechanism for passing this option to the link-editor. The following example shows how input files can be traced. This syntax can be especially useful in determining what libraries have been located, or what relocatable objects have been extracted from an archive during a link-edit.
Here the member foo.o is extracted from the archive library libfoo.a to satisfy the link-edit of prog. Notice that the archive is searched twice to verify that the extraction of foo.o did not warrant the extraction of additional relocatable objects. More than one "(again)" display indicates that the archive is a candidate for ordering using lorder(1) and tsort(1). By using the symbols token, you can determine which symbol caused an archive member to be extracted, and which object made the initial symbol reference.
The symbol foo is referenced by main.o and is added to the link-editor's internal symbol table. This symbol reference causes the extraction of the relocatable object foo.o from the archive libfoo.a. Note - This output has been simplified for this document. By using the detail token together with the symbols token, the details of symbol resolution during input file processing can be observed.
The original undefined symbol foo from main.o has been overridden with the symbol definition from the extracted archive member foo.o. The detailed symbol information reflects the attributes of each symbol. In the previous example, you can see that using some of the debugging tokens can produce a wealth of output. In cases where you are interested only in the activity around a subset of the input files, the -D option can be placed directly in the link-edit command-line, and toggled on and off. In the following example the display of symbol processing is switched on only during the processing of the library libbar.
Note - To obtain the link-edit command line you might have to expand the compilation line from any driver being used. See Using a Compiler Driver. | ||||
| ||||