blob: a20222cd59477f00d676ec905edd38600442a725 [file] [log] [blame]
Reid Spencer28e8e422004-11-21 18:20:16 +00001=pod
2
3=head1 NAME
4
5llvm-ld - LLVM linker
6
7=head1 SYNOPSIS
8
9B<llvm-ld> <options> <files>
10
11=head1 DESCRIPTION
12
13The B<llvm-ld> command is similar to the common Unix utility, C<ld>. It
14links together bytecode modules to produce an executable program.
15
16=head1 OPTIONS
17
18=head2 Input/Output Options
19
20=over
21
22=item B<-o> F<filename>
23
24This overrides the default output file and specifies the name of the file that
25should be generated by the linker. By default, B<llvm-ld> generates a file named
26F<a.out> for compatibility with B<ld>. The output will be written to
27F<filename>.
28
29=item B<-l>F<name>
30
31This option specifies the F<name> of a library to search when resolving symbols
32for the program. Only the base name should be specified as F<name>, without a
33F<lib> prefix or any suffix.
34
35=item B<-L>F<Path>
36
37This option tells B<llvm-ld> to look in F<Path> to find any library subsequently
38specified with the B<-l> option. The paths will be searched in the order in
39which they are specified on the command line. If the library is still not found,
40a small set of system specific directories will also be searched. Note that
41libraries specified with the B<-l> option that occur I<before> any B<-L> options
42will not search the paths given by the B<-L> options following it.
43
44=item B<-link-as-library>
45
46Link the bytecode files together as a library, not an executable. In this mode,
47undefined symbols will be permitted.
48
49=item B<-r>
50
51An alias for -link-as-library.
52
53=item B<-march=>C<target>
54
55Specifies the kind of machine for which code or assembly should be generated.
56
57=item B<-native>
58
59Generate a native binary instead of a shell script that runs the JIT from
60bytecode.
61
62=item B<-native-cbe>
63
64Generate a native binary with the C back end and compilation with GCC.
65
66=item B<-disable-compression>
67
68Do not compress bytecode files.
69
70=back
71
72=head2 Optimization Options
73
74=over
75
76=item B<-O0>
77
78An alias for the -O1 option.
79
80=item B<-O1>
81
82Optimize for linking speed, not execution speed. The optimizer will attempt to
83reduce the size of the linked program to reduce I/O but will not otherwise
84perform any link-time optimizations.
85
86=item B<-O2>
87
88Perform only the minimal or required set of scalar optimizations.
89
90=item B<-03>
91
92An alias for the -O2 option.
93
94=item B<-04>
95
96Perform the standard link time inter-procedural optimizations. This will
97attempt to optimize the program taking the entire program into consideration.
98
99=item B<-O5>
100
101Perform aggressive link time optimizations. This is the same as -O4 but works
102more aggressively to optimize the program.
103
104=item B<-disable-inlining>
105
106Do not run the inlining pass. Functions will not be inlined into other
107functions.
108
109=item B<-disable-opt>
110
111Completely disable optimization. The various B<-On> options will be ignored and
112no link time optimization passes will be run.
113
114=item B<-disable-internalize>
115
116Do not mark all symbols as internal.
117
118=item B<-verify>
119
120Run the verification pass after each of the passes to verify intermediate
121results.
122
123=item B<-s>
124
125Strip symbol info from the executable to make it smaller.
126
127=item B<-export-dynamic>
128
129An alias for -disable-internalize
130
131=item B<-load> F<module>
132
133Load an optimization module, F<module>, which is expected to be a dynamic
134library that provides the function name C<RunOptimizations>. This function will
135be passed the PassManager, and the optimization level (values 0-5 based on the
136B<-On> option). This function may add passes to the PassManager that should be
137run. This feature allows the optimization passes of B<llvm-ld> to be extended.
138
139=back
140
141=head2 Miscellaneous Options
142
143=item B<-v>
144
145Specifies verbose mode. In this mode the linker will print additional
146information about the actions it takes, programs it executes, etc.
147
148=head1 EXIT STATUS
149
150If B<llvm-ld> succeeds, it will exit with 0 return code. If an error occurs,
151it will exit with a non-zero return code.
152
153=head1 SEE ALSO
154
155L<llvm-ar|llvm-ar>
156
157=head1 AUTHORS
158
159Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
160
161=cut