]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kbuild: rust: skip -fmin-function-alignment in bindgen flags
authorZehui Xu <zehuixu@whu.edu.cn>
Wed, 31 Jul 2024 13:43:46 +0000 (16:43 +0300)
committerMiguel Ojeda <ojeda@kernel.org>
Fri, 9 Aug 2024 22:01:01 +0000 (00:01 +0200)
GCC 14 recently added -fmin-function-alignment option and the
root Makefile uses it to replace -falign-functions when available.
However, this flag can cause issues when passed to the Rust
Makefile and affect the bindgen process. Bindgen relies on
libclang to parse C code, and currently does not support the
-fmin-function-alignment flag, leading to compilation failures
when GCC 14 is used.

This patch addresses the issue by adding -fmin-function-alignment
to the bindgen_skip_c_flags in rust/Makefile. This prevents the
flag from causing compilation issues.

[ Matthew and Gary confirm function alignment should not change
  the ABI in a way that bindgen would care about, thus we did
  not need the extra logic for bindgen from v2. - Miguel ]

Link: https://lore.kernel.org/linux-kbuild/20240222133500.16991-1-petr.pavlu@suse.com/
Signed-off-by: Zehui Xu <zehuixu@whu.edu.cn>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/r/20240731134346.10630-1-zehuixu@whu.edu.cn
[ Reworded title. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/Makefile

index 6c0644b6090c7d3299b78cf914d45783bcebbc77..c41bae7ca8a3226d056f82b9a9dd6dd59e92319d 100644 (file)
@@ -227,7 +227,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
        -fno-reorder-blocks -fno-allow-store-data-races -fasan-shadow-offset=% \
        -fzero-call-used-regs=% -fno-stack-clash-protection \
        -fno-inline-functions-called-once -fsanitize=bounds-strict \
-       -fstrict-flex-arrays=% \
+       -fstrict-flex-arrays=% -fmin-function-alignment=% \
        --param=% --param asan-%
 
 # Derived from `scripts/Makefile.clang`.