2003-09-11 19:58:03 +00:00
|
|
|
<html>
|
2003-10-07 20:01:09 +00:00
|
|
|
<title>LLVM: gccld tool</title>
|
2003-09-11 19:58:03 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<body bgcolor=white>
|
2003-09-11 19:58:03 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<center><h1>LLVM: <tt>gccld</tt> tool</h1></center>
|
2003-09-11 19:58:03 +00:00
|
|
|
<HR>
|
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<h3>NAME</h3>
|
|
|
|
<tt>gccld</tt>
|
2003-09-11 19:58:03 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<h3>SYNOPSIS</h3>
|
|
|
|
<tt>gccld [options] < filename> [ filename ...]</tt>
|
2003-09-11 19:58:03 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<h3>DESCRIPTION</h3>
|
2003-09-11 19:58:03 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
The <tt>gccld</tt> utility takes a set of LLVM bytecode files and links them
|
|
|
|
together into a single LLVM bytecode file. The output bytecode file can be
|
|
|
|
another bytecode library or an executable bytecode program. Using additional
|
|
|
|
options, <tt>gccld</tt> is able to produce native code executables.
|
|
|
|
<p>
|
2003-09-11 19:58:03 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
The <tt>gccld</tt> utility is primarily used by the <a href="llvmgcc.html">C</a>
|
|
|
|
and <a href="llvmgxx.html">C++</a> front-ends, and as such, attempts to mimic
|
|
|
|
the interface provided by the default system linker so that it can act as a
|
|
|
|
"drop-in" replacement.
|
2003-09-11 19:58:03 +00:00
|
|
|
<p>
|
2003-10-07 20:01:09 +00:00
|
|
|
|
|
|
|
The <tt>gccld</tt> tool performs a small set of interprocedural, post-link,
|
|
|
|
optimizations on the program.
|
|
|
|
|
|
|
|
|
|
|
|
<h4>Search Order</h4>
|
|
|
|
|
2004-01-26 21:26:54 +00:00
|
|
|
<p>
|
2003-10-07 20:01:09 +00:00
|
|
|
When looking for objects specified on the command line, <tt>gccld</tt> will
|
|
|
|
search for the object first in the current directory and then in the directory
|
|
|
|
specified by the <tt>LLVM_LIB_SEARCH_PATH</tt> environment variable. If it
|
|
|
|
cannot find the object, it fails.
|
2004-01-26 21:26:54 +00:00
|
|
|
</p>
|
2003-10-07 20:01:09 +00:00
|
|
|
|
2004-01-26 21:26:54 +00:00
|
|
|
<p>
|
2003-10-07 20:01:09 +00:00
|
|
|
When looking for a library specified with the -l option, <tt>gccld</tt> first
|
|
|
|
attempts to load a file with that name from the current directory. If that
|
|
|
|
fails, it looks for lib<library>.bc, lib<library>.a, or
|
2004-01-26 21:26:54 +00:00
|
|
|
lib<library>.<shared library extension>, in that order, in each
|
|
|
|
directory added to the library search path with the -L option. These
|
|
|
|
directories are searched in the order they
|
2003-10-07 20:01:09 +00:00
|
|
|
were specified. If the library cannot be located, then <tt>gccld</tt> looks in
|
|
|
|
the directory specified by the <tt>LLVM_LIB_SEARCH_PATH</tt> environment
|
2004-01-26 21:26:54 +00:00
|
|
|
variable. If it does not find a library there, it fails.
|
|
|
|
</p>
|
2003-09-25 19:10:25 +00:00
|
|
|
|
2004-01-26 21:26:54 +00:00
|
|
|
<p>
|
|
|
|
The shared library extension is usually <tt>.so</tt>, but it may differ
|
|
|
|
depending upon the system.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
2003-09-25 19:10:25 +00:00
|
|
|
The -L option is global. It does not matter where it is specified in the list
|
|
|
|
of command line arguments; the directory is simply added to the search path and
|
|
|
|
is applied to all libraries, preceding or succeeding, in the command line.
|
2004-01-26 21:26:54 +00:00
|
|
|
</p>
|
2003-09-25 19:10:25 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<h4>Link order</h4>
|
|
|
|
|
2003-09-25 19:10:25 +00:00
|
|
|
All object files are linked first in the order they were specified on the
|
|
|
|
command line. All library files are linked next. Some libraries may not be
|
|
|
|
linked into the object program; see below.
|
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<h4>Library Linkage</h4>
|
|
|
|
|
2003-09-25 19:10:25 +00:00
|
|
|
Object files and static bytecode objects are always linked into the output
|
|
|
|
file. Library archives (.a files) load only the objects within the archive
|
|
|
|
that define symbols needed by the output file. Hence, libraries should be
|
|
|
|
listed after the object files and libraries which need them; otherwise, the
|
|
|
|
library may not be linked in, and the dependent library will not have its
|
|
|
|
undefined symbols defined.
|
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<h4>Native code generation</h4>
|
|
|
|
|
|
|
|
The <tt>gccld</tt> program has limited support for native code generation, when
|
|
|
|
using the -native option.
|
|
|
|
|
|
|
|
|
|
|
|
<h3>OPTIONS</h3>
|
2003-09-11 19:58:03 +00:00
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li> -help
|
|
|
|
<br>
|
|
|
|
Print a summary of command line options.
|
|
|
|
<p>
|
|
|
|
|
|
|
|
<li> -o <filename>
|
|
|
|
<br>
|
2003-09-25 19:10:25 +00:00
|
|
|
Specify the output filename which will hold the linked bytecode.
|
2003-09-11 19:58:03 +00:00
|
|
|
<p>
|
|
|
|
|
|
|
|
<li> -stats
|
|
|
|
<br>
|
|
|
|
Print statistics.
|
|
|
|
<p>
|
|
|
|
|
|
|
|
<li> -time-passes
|
|
|
|
<br>
|
|
|
|
Record the amount of time needed for each pass and print it to standard
|
|
|
|
error.
|
|
|
|
<p>
|
|
|
|
|
|
|
|
<li> -verify
|
|
|
|
<br>
|
|
|
|
Verify each pass result.
|
|
|
|
<p>
|
|
|
|
|
2003-11-16 23:39:11 +00:00
|
|
|
<li> -disable-opt
|
|
|
|
<br>
|
|
|
|
Disable all link-time optimization passes.
|
|
|
|
<p>
|
|
|
|
|
2003-09-11 19:58:03 +00:00
|
|
|
<li> -L=<directory>
|
|
|
|
<br>
|
|
|
|
Add directory to the list of directories to search when looking for
|
|
|
|
libraries.
|
|
|
|
<p>
|
|
|
|
|
|
|
|
<li> -disable-internalize
|
|
|
|
<br>
|
|
|
|
Do not mark all symbols as internal.
|
|
|
|
<p>
|
|
|
|
|
|
|
|
<li> -internalize-public-api-file <filename>
|
|
|
|
<br>
|
|
|
|
Preserve the list of symbol names in the file filename.
|
|
|
|
<p>
|
|
|
|
|
|
|
|
<li> -internalize-public-api-list <list>
|
|
|
|
<br>
|
|
|
|
Preserve the symbol names in list.
|
|
|
|
<p>
|
|
|
|
|
2003-09-25 19:10:25 +00:00
|
|
|
<li> -l=<library>
|
2003-09-11 19:58:03 +00:00
|
|
|
<br>
|
2003-10-07 20:01:09 +00:00
|
|
|
Specify libraries to include when linking the output file. When
|
|
|
|
linking, <tt>gccld</tt> will first attempt to load a file with the
|
2004-01-26 21:26:54 +00:00
|
|
|
pathname <tt>library</tt>. If that fails, it will then attempt to load
|
|
|
|
lib<library>.bc, lib<library>.a, and
|
|
|
|
lib<library>.<shared library extension>, in that order.
|
2003-09-11 19:58:03 +00:00
|
|
|
<p>
|
|
|
|
|
|
|
|
<li> -link-as-library
|
|
|
|
<br>
|
|
|
|
Link the .bc files together as a library, not an executable.
|
|
|
|
<p>
|
|
|
|
|
2003-09-25 19:10:25 +00:00
|
|
|
<li> -native
|
|
|
|
<br>
|
|
|
|
Generate a native, machine code executable.
|
2003-09-25 19:14:51 +00:00
|
|
|
<p>
|
2003-10-07 20:01:09 +00:00
|
|
|
When generating native executables, <tt>gccld</tt> first checks for a bytecode
|
|
|
|
version of the library and links it in, if necessary. If the library is
|
|
|
|
missing, <tt>gccld</tt> skips it. Then, <tt>gccld</tt> links in the same
|
|
|
|
libraries as native code.
|
2003-09-25 19:14:51 +00:00
|
|
|
<p>
|
2003-10-07 20:01:09 +00:00
|
|
|
In this way, <tt>gccld</tt> should be able to link in optimized bytecode
|
|
|
|
subsets of common libraries and then link in any part of the library that
|
|
|
|
hasn't been converted to bytecode.
|
2003-09-25 19:10:25 +00:00
|
|
|
<p>
|
|
|
|
|
2003-09-11 19:58:03 +00:00
|
|
|
<li> -s
|
|
|
|
<br>
|
|
|
|
Strip symbol information from the generated executable.
|
|
|
|
<p>
|
|
|
|
|
|
|
|
<li> -v
|
|
|
|
<br>
|
|
|
|
Print information about actions taken.
|
|
|
|
</ul>
|
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<h3>EXIT STATUS</h3>
|
2003-09-11 19:58:03 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
If <tt>gccld</tt> succeeds, it will exit with 0. Otherwise, if an error occurs,
|
|
|
|
it will exit with a non-zero value.
|
2003-09-11 19:58:03 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<h3>SEE ALSO</h3>
|
|
|
|
<a href="llvm-link.html"><tt>llvm-link</tt></a>
|
|
|
|
<a href="gccas.html"><tt>gccas</tt></a>
|
2003-09-25 19:10:25 +00:00
|
|
|
|
2003-10-07 20:01:09 +00:00
|
|
|
<h3>BUGS</h3>
|
2003-09-25 19:10:25 +00:00
|
|
|
The -L option cannot be used for find native code libraries when using the
|
|
|
|
-native option.
|
2003-09-11 19:58:03 +00:00
|
|
|
|
|
|
|
<HR>
|
2003-10-07 20:12:05 +00:00
|
|
|
Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
|
2003-09-11 19:58:03 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|