1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
# Codegen options
All of these options are passed to `rustc` via the `-C` flag, short for "codegen." You can see
a version of this list for your exact compiler by running `rustc -C help`.
## ar
This option is deprecated and does nothing.
## linker
This flag lets you control which linker `rustc` invokes to link your code.
## link-arg=val
This flag lets you append a single extra argument to the linker invocation.
"Append" is significant; you can pass this flag multiple times to add multiple arguments.
## link-args
This flag lets you append multiple extra arguments to the linker invocation. The
options should be separated by spaces.
## link-dead-code
Normally, the linker will remove dead code. This flag disables this behavior.
An example of when this flag might be useful is when trying to construct code coverage
metrics.
## lto
This flag instructs LLVM to use [link time
optimizations](https://llvm.org/docs/LinkTimeOptimization.html).
It takes one of two values, `thin` and `fat`. 'thin' LTO [is a new feature of
LLVM](http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html),
'fat' referring to the classic version of LTO.
## target-cpu
This instructs `rustc` to generate code specifically for a particular processor.
You can run `rustc --print target-cpus` to see the valid options to pass
here. Additionally, `native` can be passed to use the processor of the host
machine.
## target-feature
Individual targets will support different features; this flag lets you control
enabling or disabling a feature.
To see the valid options and an example of use, run `rustc --print
target-features`.
## passes
This flag can be used to add extra LLVM passes to the compilation.
The list must be separated by spaces.
## llvm-args
This flag can be used to pass a list of arguments directly to LLVM.
The list must be separated by spaces.
## save-temps
`rustc` will generate temporary files during compilation; normally it will
delete them after it's done with its work. This option will cause them to be
preserved instead of removed.
## rpath
This option allows you to set the value of
[`rpath`](https://en.wikipedia.org/wiki/Rpath).
## overflow-checks
This flag allows you to control the behavior of integer overflow. This flag
can be passed many options:
* To turn overflow checks on: `y`, `yes`, or `on`.
* To turn overflow checks off: `n`, `no`, or `off`.
## no-prepopulate-passes
The pass manager comes pre-populated with a list of passes; this flag
ensures that list is empty.
## no-vectorize-loops
By default, `rustc` will attempt to [vectorize
loops](https://llvm.org/docs/Vectorizers.html#the-loop-vectorizer). This
flag will turn that behavior off.
## no-vectorize-slp
By default, `rustc` will attempt to vectorize loops using [superword-level
parallelism](https://llvm.org/docs/Vectorizers.html#the-slp-vectorizer). This
flag will turn that behavior off.
## soft-float
This option will make `rustc` generate code using "soft floats." By default,
a lot of hardware supports floating point instructions, and so the code generated
will take advantage of this. "soft floats" emulate floating point instructions
in software.
## prefer-dynamic
By default, `rustc` prefers to statically link dependencies. This option will
make it use dynamic linking instead.
## no-integrated-as
LLVM comes with an internal assembler; this option will let you use an
external assembler instead.
## no-redzone
This flag allows you to disable [the
red zone](https://en.wikipedia.org/wiki/Red_zone_\(computing\)). This flag can
be passed many options:
* To enable the red zone: `y`, `yes`, or `on`.
* To disable it: `n`, `no`, or `off`.
## relocation-model
This option lets you choose which relocation model to use.
To find the valid options for this flag, run `rustc --print relocation-models`.
## code-model=val
This option lets you choose which code model to use.
To find the valid options for this flag, run `rustc --print code-models`.
## metadata
This option allows you to control the metadata used for symbol mangling.
## extra-filename
This option allows you to put extra data in each output filename.
## codegen-units
This flag lets you control how many threads are used when doing
code generation.
Increasing parallelism may speed up compile times, but may also
produce slower code.
## remark
This flag lets you print remarks for these optimization passes.
The list of passes should be separated by spaces.
`all` will remark on every pass.
## no-stack-check
This option is deprecated and does nothing.
## debuginfo
This flag lets you control debug information:
* `0`: no debug info at all
* `1`: line tables only
* `2`: full debug info
## opt-level
This flag lets you control the optimization level.
* `0`: no optimizations
* `1`: basic optimizations
* `2`: some optimizations
* `3`: all optimizations
* `s`: optimize for binary size
* `z`: optimize for binary size, but also turn off loop vectorization.
## debug-assertions
This flag lets you turn `cfg(debug_assertions)` on or off.
## inline-threshold
This option lets you set the threshold for inlining a function.
The default is 225.
## panic
This option lets you control what happens when the code panics.
* `abort`: terminate the process upon panic
* `unwind`: unwind the stack upon panic
## incremental
This flag allows you to enable incremental compilation.
|