Skip to content

Commit 696892f

Browse files
committed
Improve documentation of -Cjump-tables
Be more verbose about what this option can and cannot do.
1 parent 08d2690 commit 696892f

File tree

1 file changed

+11
-4
lines changed
  • src/doc/rustc/src/codegen-options

1 file changed

+11
-4
lines changed

src/doc/rustc/src/codegen-options/index.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,22 @@ with coverage tools other than those built and shipped with the compiler.
212212
## jump-tables
213213

214214
This option is used to allow or prevent the LLVM or GCC codegen backend from
215-
creating jump tables when lowering switches.
215+
creating jump tables when lowering switches from Rust code.
216216

217217
* `y`, `yes`, `on`, `true` or no value: allow jump tables (the default).
218218
* `n`, `no`, `off` or `false`: disable jump tables.
219219

220+
To prevent jump tables being created from Rust code, a target must ensure
221+
all crates are compiled with jump tables disabled.
222+
223+
Note, in many cases the rust toolchain is distributed with precompiled
224+
crates which could possibly include jump tables. Furthermore, this option
225+
does not guarantee a target will be free of jump tables. They could arise
226+
from external dependencies, inline asm, or other complicated interactions
227+
when using crates which are compiled with jump table support.
228+
220229
Disabling jump tables can be used to help provide protection against
221-
jump-oriented-programming (JOP) attacks. However, this option makes
222-
no guarantee any precompiled or external dependencies are compiled
223-
with or without jump tables.
230+
jump-oriented-programming (JOP) attacks.
224231

225232
## link-arg
226233

0 commit comments

Comments
 (0)