diff options
author | Andrea Righi | 2023-08-15 08:53:46 +0200 |
---|---|---|
committer | Miguel Ojeda | 2023-10-12 22:58:52 +0200 |
commit | 344b6c0a7514b044ed12b8ad3cdeecd262292f3e (patch) | |
tree | 679f835d0611a54d069633c299ed920f9d04ace0 /mm/io-mapping.c | |
parent | 2a7e0a52ec98566a863aba42ea35690c65e3da27 (diff) |
rust: fix bindgen build error with fstrict-flex-arrays
Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") enabled
'-fstrict-flex-arrays=3' globally, but bindgen does not recognized this
compiler option, triggering the following build error:
error: unknown argument: '-fstrict-flex-arrays=3', err: true
[ Miguel: Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3")
did it so only conditionally (i.e. only if the C compiler supports
it). This explains what Andrea was seeing: he was compiling with a
modern enough GCC, which enables the option, but with an old enough
Clang. Andrea confirmed this was the case: he was using Clang 14 with
GCC 13; and that Clang 15 worked for him.
While it is possible to construct code (see mailing list for an
example I came up with) where this could break, it is fairly
contrived, and anyway GCC-built kernels with Rust enabled should
only be used for experimentation until we get support for
`rustc_codegen_gcc` and/or GCC Rust. So let's add this for the
time being in case it helps somebody. ]
Add '-fstrict-flex-arrays' to the list of cflags that should be ignored
by bindgen.
Fixes: df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3")
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Tested-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/r/20230815065346.131387-1-andrea.righi@canonical.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'mm/io-mapping.c')
0 files changed, 0 insertions, 0 deletions