OpenCloudOS-Kernel/rust
Andrea Righi d966c3cab9 rust: allow to use INIT_STACK_ALL_ZERO
With CONFIG_INIT_STACK_ALL_ZERO enabled, bindgen passes
-ftrivial-auto-var-init=zero to clang, that triggers the following
error:

 error: '-ftrivial-auto-var-init=zero' hasn't been enabled; enable it at your own peril for benchmarking purpose only with '-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang'

However, this additional option that is currently required by clang is
deprecated since clang-16 and going to be removed in the future,
likely with clang-18.

So, make sure bindgen is using this extra option if the major version of
the libclang used by bindgen is < 16.

In this way we can enable CONFIG_INIT_STACK_ALL_ZERO with CONFIG_RUST
without triggering any build error.

Link: https://github.com/llvm/llvm-project/issues/44842
Link: https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0-rc2/clang/docs/ReleaseNotes.rst#deprecated-compiler-flags
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
[Changed to < 16, added link and reworded]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-04-19 19:34:43 +02:00
..
alloc rust: alloc: remove the `borrow` module (`ToOwned`, `Cow`) 2023-01-16 21:03:49 +01:00
bindings rust: sync: add `Arc` for ref-counted allocations 2023-01-16 22:20:03 +01:00
kernel rust: kernel: Mark rust_fmt_argument as extern "C" 2023-04-06 23:11:04 +02:00
macros rust: macros: take string literals in `module!` 2022-12-04 01:59:15 +01:00
.gitignore kbuild: rust: move rust/target.json to scripts/ 2023-01-22 23:43:33 +09:00
Makefile rust: allow to use INIT_STACK_ALL_ZERO 2023-04-19 19:34:43 +02:00
bindgen_parameters rust: bindgen: Add `alt_instr` as opaque type 2023-03-02 22:44:15 +01:00
build_error.rs rust: add `build_error` crate 2022-12-04 01:59:16 +01:00
compiler_builtins.rs rust: compiler_builtins: make stubs non-global 2023-01-16 21:04:34 +01:00
exports.c rust: add `build_error` crate 2022-12-04 01:59:16 +01:00
helpers.c rust: sync: add `Arc` for ref-counted allocations 2023-01-16 22:20:03 +01:00