6 gccld - optimizing LLVM linker
10 gccld [options] file1 [file2 ...]
14 The B<gccld> utility takes a set of LLVM bytecode files and links them
15 together into a single LLVM bytecode file. The output bytecode file can be
16 another bytecode library or an executable bytecode program. Using additional
17 options, B<gccld> is able to produce native code executables.
19 The B<gccld> utility is primarily used by the L<llvmgcc> and
20 L<llvmg++|llvmgxx> front-ends, and as such, attempts to mimic the interface
21 provided by the default system linker so that it can act as a ``drop-in''
24 The B<gccld> tool performs a small set of interprocedural, post-link
25 optimizations on the program.
29 When looking for objects specified on the command line, B<gccld> will search for
30 the object first in the current directory and then in the directory specified by
31 the B<LLVM_LIB_SEARCH_PATH> environment variable. If it cannot find the object,
34 When looking for a library specified with the B<-l> option, B<gccld> first
35 attempts to load a file with that name from the current directory. If that
36 fails, it looks for libI<library>.bc, libI<library>.a, or libI<library>.I<shared
37 library extension>, in that order, in each directory added to the library search
38 path with the B<-L> option. These directories are searched in the order they
39 were specified. If the library cannot be located, then B<gccld> looks in the
40 directory specified by the B<LLVM_LIB_SEARCH_PATH> environment variable. If it
41 does not find a library there, it fails.
43 The shared library extension may be I<.so>, I<.dyld>, I<.dll>, or something
44 different, depending upon the system.
46 The B<-L> option is global. It does not matter where it is specified in the
47 list of command line arguments; the directory is simply added to the search path
48 and is applied to all libraries, preceding or succeeding, in the command line.
52 All object files are linked first in the order they were specified on the
53 command line. All library files are linked next. Some libraries may not be
54 linked into the object program; see below.
56 =head2 Library Linkage
58 Object files and static bytecode objects are always linked into the output
59 file. Library archives (.a files) load only the objects within the archive
60 that define symbols needed by the output file. Hence, libraries should be
61 listed after the object files and libraries which need them; otherwise, the
62 library may not be linked in, and the dependent library will not have its
63 undefined symbols defined.
65 =head2 Native code generation
67 The B<gccld> program has limited support for native code generation, when
68 using the B<-native> or B<-native-cbe> options.
76 Print a summary of command line options.
78 =item B<-o> I<filename>
80 Specify the output filename which will hold the linked bytecode.
88 Record the amount of time needed for each pass and print it to standard
93 Verify each pass result.
97 Disable all link-time optimization passes.
99 =item B<-disable-inlining>
101 Do not run the inliner pass.
103 =item B<-L>I<directory>
105 Add directory to the list of directories to search when looking for
108 =item B<-disable-internalize>
110 Do not mark all symbols as internal.
112 =item B<-internalize-public-api-file> I<filename>
114 Preserve the list of symbol names in the file filename.
116 =item B<-internalize-public-api-list <list>>
118 Preserve the symbol names in list.
120 =item B<-l>I<library>
122 Specify libraries to include when linking the output file. When linking,
123 B<gccld> will first attempt to load a file with the pathname B<library>. If
124 that fails, it will then attempt to load libI<library>.bc, libI<library>.a, and
125 libI<library>.I<shared library extension>, in that order.
127 =item B<-link-as-library>
129 Link the .bc files together as a library, not an executable.
133 Generate a native machine code executable.
135 When generating native executables, B<gccld> first checks for a bytecode
136 version of the library and links it in, if necessary. If the library is
137 missing, B<gccld> skips it. Then, B<gccld> links in the same
138 libraries as native code.
140 In this way, B<gccld> should be able to link in optimized bytecode
141 subsets of common libraries and then link in any part of the library that
142 hasn't been converted to bytecode.
146 Generate a native machine code executable with the LLVM C backend.
148 This option is identical to the B<-native> option, but uses the
149 C backend to generate code for the program instead of an LLVM native
154 Strip symbol information from the generated executable.
158 Print information about actions taken.
164 If B<gccld> succeeds, it will exit with an exit status of 0.
165 Otherwise, if an error occurs, it will exit with a non-zero exit
170 L<llvm-link>, L<gccas>
174 Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).