blob: 6eef165db6975971b27b1ac3b3be05ad7913ae6e [file] [log] [blame]
John Criswellecf32e52003-09-11 19:58:03 +00001<html>
2<title>
Chris Lattneree43b692003-09-25 19:50:05 +00003LLVM: gccld tool
John Criswellecf32e52003-09-11 19:58:03 +00004</title>
5
6<body>
7
8<center>
Chris Lattneree43b692003-09-25 19:50:05 +00009<h1>LLVM: gccld tool</h1>
John Criswellecf32e52003-09-11 19:58:03 +000010</center>
11<HR>
12
13<h3>
14NAME
15</h3>
16
17gccld
18
19<h3>
20SYNOPSIS
21</h3>
22
John Criswell52f68b82003-09-25 19:10:25 +000023gccld [options] &lt; filename&gt; [ filename ...]
John Criswellecf32e52003-09-11 19:58:03 +000024<h3>
25DESCRIPTION
26</h3>
27
John Criswell52f68b82003-09-25 19:10:25 +000028The gccld utility takes a set of LLVM bytecode files and links them together
29into a single LLVM bytecode file. The output bytecode file can be another
30bytecode library or an executable bytecode program. Using additional options,
31gccld is able to produce native code executables.
John Criswellecf32e52003-09-11 19:58:03 +000032<p>
33The gccld utility is primarily used by the GCC front end, and as such, attempts
34to mimic the interface provided by the default system linker so that it can act
35as a "drop-in" replacement.
36
John Criswell52f68b82003-09-25 19:10:25 +000037<h4>
38Search Order
39</h4>
40When looking for objects specified on the command line, gccld will search for
41the object first in the current directory and then in the directory specified
42by LLVM_LIB_SEARCH_PATH. If it cannot find the object, it fails.
43<p>
44When looking for a library specified with the -l option, gccld first attempts
45to load a file with that name from the current directory. If that fails, it
46looks for lib&lt;library&gt;.bc, lib&lt;library&gt;.a, or
47lib&lt;library&gt;.so, in that order, in each directory added to the library
48search path with the -L option. These directories are searched in order they
49were specified. If the library cannot be located, then gccld looks in the
50directory specified by the LLVM_LIB_SEARCH_PATH environment variable. If it
51does not find lib&lt;library&gt;.[bc | a | so] there, it fails.
52
53The -L option is global. It does not matter where it is specified in the list
54of command line arguments; the directory is simply added to the search path and
55is applied to all libraries, preceding or succeeding, in the command line.
56
57<h4>
58Link order
59</h4>
60All object files are linked first in the order they were specified on the
61command line. All library files are linked next. Some libraries may not be
62linked into the object program; see below.
63
64<h4>
65Library Linkage
66</h4>
67Object files and static bytecode objects are always linked into the output
68file. Library archives (.a files) load only the objects within the archive
69that define symbols needed by the output file. Hence, libraries should be
70listed after the object files and libraries which need them; otherwise, the
71library may not be linked in, and the dependent library will not have its
72undefined symbols defined.
73
74<h4>
75Native code generation
76</h4>
77The gccld program has limited support for native code generation.
John Criswellecf32e52003-09-11 19:58:03 +000078<h3>
79OPTIONS
80</h3>
81
82<ul>
83 <li> -help
84 <br>
85 Print a summary of command line options.
86 <p>
87
88 <li> -o &lt;filename&gt;
89 <br>
John Criswell52f68b82003-09-25 19:10:25 +000090 Specify the output filename which will hold the linked bytecode.
John Criswellecf32e52003-09-11 19:58:03 +000091 <p>
92
93 <li> -stats
94 <br>
95 Print statistics.
96 <p>
97
98 <li> -time-passes
99 <br>
100 Record the amount of time needed for each pass and print it to standard
101 error.
102 <p>
103
104 <li> -verify
105 <br>
106 Verify each pass result.
107 <p>
108
109 <li> -L=&lt;directory&gt;
110 <br>
111 Add directory to the list of directories to search when looking for
112 libraries.
113 <p>
114
115 <li> -disable-internalize
116 <br>
117 Do not mark all symbols as internal.
118 <p>
119
120 <li> -internalize-public-api-file &lt;filename&gt;
121 <br>
122 Preserve the list of symbol names in the file filename.
123 <p>
124
125 <li> -internalize-public-api-list &lt;list&gt;
126 <br>
127 Preserve the symbol names in list.
128 <p>
129
John Criswell52f68b82003-09-25 19:10:25 +0000130 <li> -l=&lt;library&gt;
John Criswellecf32e52003-09-11 19:58:03 +0000131 <br>
John Criswell52f68b82003-09-25 19:10:25 +0000132 Specify libraries to include when linking the output file. When linking,
133 gccld will first attempt to load a file with the pathname library. If that
134 fails, it will then attempt to load lib&lt;library&gt;.bc,
135 lib&lt;library&gt;.a, and lib&lt;library&gt;.so, in that order.
John Criswellecf32e52003-09-11 19:58:03 +0000136 <p>
137
138 <li> -link-as-library
139 <br>
140 Link the .bc files together as a library, not an executable.
141 <p>
142
John Criswell52f68b82003-09-25 19:10:25 +0000143 <li> -native
144 <br>
145 Generate a native, machine code executable.
John Criswellb7fcd302003-09-25 19:14:51 +0000146 <p>
147 When generating native executables, gccld first checks for a bytecode version
148 of the library and links it in, if necessary. If the library is missing,
149 gccld skips it. Then, gccld links in the same libraries as native code.
150 <p>
151 In this way, gccld should be able to link in optimized bytecode subsets of
152 common libraries and then link in any part of the library that hasn't been
153 converted to bytecode.
John Criswell52f68b82003-09-25 19:10:25 +0000154 <p>
155
John Criswellecf32e52003-09-11 19:58:03 +0000156 <li> -s
157 <br>
158 Strip symbol information from the generated executable.
159 <p>
160
161 <li> -v
162 <br>
163 Print information about actions taken.
164</ul>
165
166<h3>
167EXIT STATUS
168</h3>
169
170If gccld succeeds, it will exit with 0. Otherwise, if an error occurs, it
171will exit with a non-zero value.
172
173<h3>
174SEE ALSO
175</h3>
John Criswell52f68b82003-09-25 19:10:25 +0000176gccas
177
178<h3>
179BUGS
180</h3>
181The -L option cannot be used for find native code libraries when using the
182-native option.
John Criswellecf32e52003-09-11 19:58:03 +0000183
184<HR>
John Criswell32003302003-09-11 20:23:52 +0000185<a href="http://llvm.cs.uiuc.edu">LLVM Team</a>
John Criswellecf32e52003-09-11 19:58:03 +0000186</body>
187</html>
188