blob: 6b0257485fe7cfcbde0771bd2157e4a0d61afb23 [file] [log] [blame]
Misha Brukman89fe7de2004-07-01 17:53:27 +00001
2=pod
3
4=head1 NAME
5
6gccld - optimizing LLVM linker
7
8=head1 SYNOPSIS
9
10gccld [options] file1 [file2 ...]
11
12=head1 DESCRIPTION
13
14The B<gccld> utility takes a set of LLVM bytecode files and links them
15together into a single LLVM bytecode file. The output bytecode file can be
16another bytecode library or an executable bytecode program. Using additional
17options, B<gccld> is able to produce native code executables.
18
19The B<gccld> utility is primarily used by the L<llvmgcc> and
20L<llvmg++|llvmgxx> front-ends, and as such, attempts to mimic the interface
21provided by the default system linker so that it can act as a ``drop-in''
22replacement.
23
24The B<gccld> tool performs a small set of interprocedural, post-link
25optimizations on the program.
26
27=head2 Search Order
28
29When looking for objects specified on the command line, B<gccld> will search for
30the object first in the current directory and then in the directory specified by
31the B<LLVM_LIB_SEARCH_PATH> environment variable. If it cannot find the object,
32it fails.
33
34When looking for a library specified with the B<-l> option, B<gccld> first
35attempts to load a file with that name from the current directory. If that
36fails, it looks for libI<library>.bc, libI<library>.a, or libI<library>.I<shared
37library extension>, in that order, in each directory added to the library search
38path with the B<-L> option. These directories are searched in the order they
39were specified. If the library cannot be located, then B<gccld> looks in the
40directory specified by the B<LLVM_LIB_SEARCH_PATH> environment variable. If it
41does not find a library there, it fails.
42
43The shared library extension may be I<.so>, I<.dyld>, I<.dll>, or something
44different, depending upon the system.
45
46The B<-L> option is global. It does not matter where it is specified in the
47list of command line arguments; the directory is simply added to the search path
48and is applied to all libraries, preceding or succeeding, in the command line.
49
50=head2 Link order
51
52All object files are linked first in the order they were specified on the
53command line. All library files are linked next. Some libraries may not be
54linked into the object program; see below.
55
56=head2 Library Linkage
57
58Object files and static bytecode objects are always linked into the output
59file. Library archives (.a files) load only the objects within the archive
60that define symbols needed by the output file. Hence, libraries should be
61listed after the object files and libraries which need them; otherwise, the
62library may not be linked in, and the dependent library will not have its
63undefined symbols defined.
64
65=head2 Native code generation
66
67The B<gccld> program has limited support for native code generation, when
68using the B<-native> or B<-native-cbe> options.
69
70=head1 OPTIONS
71
72=over
73
74=item B<-help>
75
76Print a summary of command line options.
77
78=item B<-o> I<filename>
79
80Specify the output filename which will hold the linked bytecode.
81
82=item B<-stats>
83
84Print statistics.
85
86=item B<-time-passes>
87
88Record the amount of time needed for each pass and print it to standard
89error.
90
91=item B<-verify>
92
93Verify each pass result.
94
95=item B<-disable-opt>
96
97Disable all link-time optimization passes.
98
99=item B<-disable-inlining>
100
101Do not run the inliner pass.
102
103=item B<-L>I<directory>
104
105Add directory to the list of directories to search when looking for
106libraries.
107
108=item B<-disable-internalize>
109
110Do not mark all symbols as internal.
111
112=item B<-internalize-public-api-file> I<filename>
113
114Preserve the list of symbol names in the file filename.
115
116=item B<-internalize-public-api-list &lt;list&gt;>
117
118Preserve the symbol names in list.
119
120=item B<-l>I<library>
121
122Specify libraries to include when linking the output file. When linking,
123B<gccld> will first attempt to load a file with the pathname B<library>. If
124that fails, it will then attempt to load libI<library>.bc, libI<library>.a, and
125libI<library>.I<shared library extension>, in that order.
126
127=item B<-link-as-library>
128
129Link the .bc files together as a library, not an executable.
130
131=item B<-native>
132
133Generate a native machine code executable.
134
135When generating native executables, B<gccld> first checks for a bytecode
136version of the library and links it in, if necessary. If the library is
137missing, B<gccld> skips it. Then, B<gccld> links in the same
138libraries as native code.
139
140In this way, B<gccld> should be able to link in optimized bytecode
141subsets of common libraries and then link in any part of the library that
142hasn't been converted to bytecode.
143
144=item B<-native-cbe>
145
146Generate a native machine code executable with the LLVM C backend.
147
148This option is identical to the B<-native> option, but uses the
149C backend to generate code for the program instead of an LLVM native
150code generator.
151
152=item B<-s>
153
154Strip symbol information from the generated executable.
155
156=item B<-v>
157
158Print information about actions taken.
159
160=back
161
162=head1 EXIT STATUS
163
164If B<gccld> succeeds, it will exit with an exit status of 0.
165Otherwise, if an error occurs, it will exit with a non-zero exit
166status.
167
168=head1 SEE ALSO
169
170L<llvm-link>, L<gccas>
171
172=head1 AUTHORS
173
174Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
175
176=cut
177