xref: /llvm-project/llvm/docs/CommandGuide/llvm-link.rst (revision c402498f9a86f507b68ff8159e5efbec3c63f7a3)
1llvm-link - LLVM bitcode linker
2===============================
3
4.. program:: llvm-link
5
6SYNOPSIS
7--------
8
9:program:`llvm-link` [*options*] *filename ...*
10
11DESCRIPTION
12-----------
13
14:program:`llvm-link` takes several LLVM bitcode files and links them together
15into a single LLVM bitcode file.  It writes the output file to standard output,
16unless the :option:`-o` option is used to specify a filename.
17
18OPTIONS
19-------
20
21.. option:: -f
22
23 Enable binary output on terminals.  Normally, :program:`llvm-link` will refuse
24 to write raw bitcode output if the output stream is a terminal. With this
25 option, :program:`llvm-link` will write raw bitcode regardless of the output
26 device.
27
28.. option:: -o filename
29
30 Specify the output file name.  If ``filename`` is "``-``", then
31 :program:`llvm-link` will write its output to standard output.
32
33.. option:: -S
34
35 Write output in LLVM intermediate language (instead of bitcode).
36
37.. option:: -d
38
39 If specified, :program:`llvm-link` prints a human-readable version of the
40 output bitcode file to standard error.
41
42.. option:: --help
43
44 Print a summary of command line options.
45
46.. option:: -v
47
48 Verbose mode.  Print information about what :program:`llvm-link` is doing.
49 This typically includes a message for each bitcode file linked in and for each
50 library found.
51
52.. option:: --override <filename>
53
54  Adds the passed-in file to the link and overrides symbols that have already
55  been declared with the definitions in the file that is passed in. This flag
56  can be specified multiple times to have multiple files act as overrides. If
57  a symbol is declared more than twice, the definition from the file declared
58  last takes precedence.
59
60.. option:: --import <function:filename>
61
62  Specify a function that should be imported from the specified file for
63  linking with ThinLTO. This option can be specified multiple times to import
64  multiple functions.
65
66.. option:: --summary-index <filename>
67
68  Specify the path to a file containing the module summary index with the
69  results of an earlier ThinLTO link. This option is required when
70  `--import` is used.
71
72.. option:: --internalize
73
74  Internalize the linked symbols.
75
76.. option:: --disable-debug-info-type-map
77
78  Disables the use of a uniquing type map for debug info.
79
80.. option:: --only-needed
81
82  Link only needed symbols.
83
84.. option:: --disable-lazy-loading
85
86  Disable lazy module loading.
87
88.. option:: --suppress-warnings
89
90  Suppress all linker warnings.
91
92.. option:: --preserve-bc-uselistorder
93
94  Preserve the use-list order when writing LLVM bitcode.
95
96.. option:: --preserve-ll-uselistorder
97
98  Preserve the use-list order when writing LLVM assembly.
99
100.. option:: --ignore-non-bitcode
101
102  Do not error out when a non-bitcode file is encountered while processing
103  an archive.
104
105EXIT STATUS
106-----------
107
108If :program:`llvm-link` succeeds, it will exit with 0.  Otherwise, if an error
109occurs, it will exit with a non-zero value.
110