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