Skip to content

Commit 34e914d

Browse files
committed
Improve documentation of -Cjump-tables
Be more verbose about what this option can and cannot do.
1 parent ad7b278 commit 34e914d

File tree

1 file changed

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

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,23 @@ 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 codegen backend from creating
215-
jump tables when lowering switches.
215+
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, such as the core and std crates, which could possibly include
225+
jump tables. Furthermore, this option does not guarantee a target will
226+
be free of jump tables. They could arise from external dependencies,
227+
inline asm, or other complicated interactions when using crates which
228+
are compiled with jump table support.
229+
220230
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.
231+
jump-oriented-programming (JOP) attacks.
224232

225233
## link-arg
226234

0 commit comments

Comments
 (0)