.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "LLVM-LD 1" .TH LLVM-LD 1 "2011-04-09" "CVS" "LLVM Command Guide" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" llvm\-ld \- LLVM linker .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBllvm-ld\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \fBllvm-ld\fR tool takes a set of \s-1LLVM\s0 bitcode files and links them together into a single \s-1LLVM\s0 bitcode file. The output bitcode file can be another bitcode file or an executable bitcode program. Using additional options, \fBllvm-ld\fR is able to produce native code executables. .PP The \fBllvm-ld\fR tool is the main linker for \s-1LLVM\s0. It is used to link together the output of \s-1LLVM\s0 front-end compilers and run \*(L"link time\*(R" optimizations (mostly the inter-procedural kind). .PP The \fBllvm-ld\fR tools attempts to mimic the interface provided by the default system linker so that it can act as a \fIdrop-in\fR replacement. .SS "Search Order" .IX Subsection "Search Order" When looking for objects specified on the command line, \fBllvm-ld\fR will search for the object first in the current directory and then in the directory specified by the \fB\s-1LLVM_LIB_SEARCH_PATH\s0\fR environment variable. If it cannot find the object, it fails. .PP When looking for a library specified with the \fB\-l\fR option, \fBllvm-ld\fR first attempts to load a file with that name from the current directory. If that fails, it looks for lib\fIlibrary\fR.bc, lib\fIlibrary\fR.a, or lib\fIlibrary\fR.\fIshared library extension\fR, in that order, in each directory added to the library search path with the \fB\-L\fR option. These directories are searched in the order they are specified. If the library cannot be located, then \fBllvm-ld\fR looks in the directory specified by the \fB\s-1LLVM_LIB_SEARCH_PATH\s0\fR environment variable. If it does not find a library there, it fails. .PP The \fIshared library extension\fR may be \fI.so\fR, \fI.dyld\fR, \fI.dll\fR, or something different, depending upon the system. .PP The \fB\-L\fR 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. .SS "Link order" .IX Subsection "Link order" All object and bitcode 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. .SS "Library Linkage" .IX Subsection "Library Linkage" Object files and static bitcode 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. .SS "Native code generation" .IX Subsection "Native code generation" The \fBllvm-ld\fR program has limited support for native code generation, when using the \fB\-native\fR or \fB\-native\-cbe\fR options. Native code generation is performed by converting the linked bitcode into native assembly (.s) or C code and running the system compiler (typically gcc) on the result. .SH "OPTIONS" .IX Header "OPTIONS" .SS "General Options" .IX Subsection "General Options" .IP "\fB\-help\fR" 4 .IX Item "-help" Print a summary of command line options. .IP "\fB\-v\fR" 4 .IX Item "-v" Specifies verbose mode. In this mode the linker will print additional information about the actions it takes, programs it executes, etc. .IP "\fB\-stats\fR" 4 .IX Item "-stats" Print statistics. .IP "\fB\-time\-passes\fR" 4 .IX Item "-time-passes" Record the amount of time needed for each pass and print it to standard error. .SS "Input/Output Options" .IX Subsection "Input/Output Options" .IP "\fB\-o\fR \fIfilename\fR" 4 .IX Item "-o filename" This overrides the default output file and specifies the name of the file that should be generated by the linker. By default, \fBllvm-ld\fR generates a file named \&\fIa.out\fR for compatibility with \fBld\fR. The output will be written to \&\fIfilename\fR. .IP "\fB\-b\fR \fIfilename\fR" 4 .IX Item "-b filename" This option can be used to override the output bitcode file name. By default, the name of the bitcode output file is one more \*(L".bc\*(R" suffix added to the name specified by \fB\-o filename\fR option. .IP "\fB\-l\fR\fIname\fR" 4 .IX Item "-lname" This option specifies the \fIname\fR of a library to search when resolving symbols for the program. Only the base name should be specified as \fIname\fR, without a \&\fIlib\fR prefix or any suffix. .IP "\fB\-L\fR\fIPath\fR" 4 .IX Item "-LPath" This option tells \fBllvm-ld\fR to look in \fIPath\fR to find any library subsequently specified with the \fB\-l\fR option. The paths will be searched in the order in which they are specified on the command line. If the library is still not found, a small set of system specific directories will also be searched. Note that libraries specified with the \fB\-l\fR option that occur \fIbefore\fR any \fB\-L\fR options will not search the paths given by the \fB\-L\fR options following it. .IP "\fB\-link\-as\-library\fR" 4 .IX Item "-link-as-library" Link the bitcode files together as a library, not an executable. In this mode, undefined symbols will be permitted. .IP "\fB\-r\fR" 4 .IX Item "-r" An alias for \-link\-as\-library. .IP "\fB\-native\fR" 4 .IX Item "-native" Generate a native machine code executable. .Sp When generating native executables, \fBllvm-ld\fR first checks for a bitcode version of the library and links it in, if necessary. If the library is missing, \fBllvm-ld\fR skips it. Then, \fBllvm-ld\fR links in the same libraries as native code. .Sp In this way, \fBllvm-ld\fR should be able to link in optimized bitcode subsets of common libraries and then link in any part of the library that hasn't been converted to bitcode. .IP "\fB\-native\-cbe\fR" 4 .IX Item "-native-cbe" Generate a native machine code executable with the \s-1LLVM\s0 C backend. .Sp This option is identical to the \fB\-native\fR option, but uses the C backend to generate code for the program instead of an \s-1LLVM\s0 native code generator. .SS "Optimization Options" .IX Subsection "Optimization Options" .IP "\fB\-disable\-inlining\fR" 4 .IX Item "-disable-inlining" Do not run the inlining pass. Functions will not be inlined into other functions. .IP "\fB\-disable\-opt\fR" 4 .IX Item "-disable-opt" Completely disable optimization. .IP "\fB\-disable\-internalize\fR" 4 .IX Item "-disable-internalize" Do not mark all symbols as internal. .IP "\fB\-verify\-each\fR" 4 .IX Item "-verify-each" Run the verification pass after each of the passes to verify intermediate results. .IP "\fB\-strip\-all\fR" 4 .IX Item "-strip-all" Strip all debug and symbol information from the executable to make it smaller. .IP "\fB\-strip\-debug\fR" 4 .IX Item "-strip-debug" Strip all debug information from the executable to make it smaller. .IP "\fB\-s\fR" 4 .IX Item "-s" An alias for \fB\-strip\-all\fR. .IP "\fB\-S\fR" 4 .IX Item "-S" An alias for \fB\-strip\-debug\fR. .IP "\fB\-export\-dynamic\fR" 4 .IX Item "-export-dynamic" An alias for \fB\-disable\-internalize\fR .IP "\fB\-post\-link\-opt\fR\fIPath\fR" 4 .IX Item "-post-link-optPath" Run post-link optimization program. After linking is completed a bitcode file will be generated. It will be passed to the program specified by \fIPath\fR as the first argument. The second argument to the program will be the name of a temporary file into which the program should place its optimized output. For example, the \*(L"no-op optimization\*(R" would be a simple shell script: .Sp .Vb 2 \& #!/bin/bash \& cp $1 $2 .Ve .SH "EXIT STATUS" .IX Header "EXIT STATUS" If \fBllvm-ld\fR succeeds, it will exit with 0 return code. If an error occurs, it will exit with a non-zero return code. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" The \f(CW\*(C`LLVM_LIB_SEARCH_PATH\*(C'\fR environment variable is used to find bitcode libraries. Any paths specified in this variable will be searched after the \f(CW\*(C`\-L\*(C'\fR options. .SH "SEE ALSO" .IX Header "SEE ALSO" llvm-link .SH "AUTHORS" .IX Header "AUTHORS" Maintained by the \s-1LLVM\s0 Team ().