1
Fork 0

Add -Zno-jump-tables

This flag mimics GCC/Clang's `-fno-jump-tables` [1][2], which makes
the codegen backend avoid generating jump tables when lowering switches.

In the case of LLVM, the `"no-jump-tables"="true"` function attribute is
added to every function.

The kernel currently needs it for x86 when enabling IBT [3], as well
as for Alpha (plus VDSO objects in MIPS/LoongArch).

[1] https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-jump-tables
[2] https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fjump-tables
[3] https://github.com/torvalds/linux/blob/v6.1/arch/x86/Makefile#L75-L83

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
Miguel Ojeda 2022-12-17 02:50:08 +01:00
parent 9c07efe84f
commit a65ec44779
6 changed files with 69 additions and 0 deletions

View file

@ -754,6 +754,7 @@ fn test_unstable_options_tracking_hash() {
tracked!(move_size_limit, Some(4096));
tracked!(mutable_noalias, Some(true));
tracked!(no_generate_arange_section, true);
tracked!(no_jump_tables, true);
tracked!(no_link, true);
tracked!(no_profiler_runtime, true);
tracked!(no_unique_section_names, true);