Skip to content

Commit 08d2690

Browse files
committed
Enable -C jump-tables=no support in gcc codegen backend
1 parent ad7b278 commit 08d2690

File tree

2 files changed

+7
-2
lines changed
  • compiler/rustc_codegen_gcc/src
  • src/doc/rustc/src/codegen-options

2 files changed

+7
-2
lines changed

compiler/rustc_codegen_gcc/src/base.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ pub fn compile_codegen_unit(
126126
for arg in &tcx.sess.opts.cg.llvm_args {
127127
context.add_command_line_option(arg);
128128
}
129+
130+
if !tcx.sess.opts.cg.jump_tables {
131+
context.add_command_line_option("-fno-jump-tables");
132+
}
133+
129134
// NOTE: This is needed to compile the file src/intrinsic/archs.rs during a bootstrap of rustc.
130135
context.add_command_line_option("-fno-var-tracking-assignments");
131136
// NOTE: an optimization (https://github.com/rust-lang/rustc_codegen_gcc/issues/53).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ with coverage tools other than those built and shipped with the compiler.
211211

212212
## jump-tables
213213

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

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

0 commit comments

Comments
 (0)