rust/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
GCC recently added the -fmin-function-alignment option, which will appear in GCC 14. 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, ensuring it is skipped during the bindgen process. This prevents the flag from causing compilation issues and maintains compatibility with the upcoming GCC 14.
This is my first patch to the kernel, if there are any issues or improvements needed, please let me know. ;)
Reference:
https://lore.kernel.org/linux-kbuild/20240222133500.16991-1-petr.pavlu@suse.com/
Signed-off-by: Zehui Xu <zehuixu@whu.edu.cn>
---
rust/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile
index 1f10f92737f2..0c8736cce64f 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -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`.
--
2.45.2
On 31.7.2024 2.39, Miguel Ojeda wrote: > On Wed, Jul 31, 2024 at 12:21 AM Zehui Xu <zehuixu@whu.edu.cn> wrote: >> >> GCC recently added the -fmin-function-alignment option, which will appear in GCC 14. 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, ensuring it is skipped during the bindgen process. This prevents the flag from causing compilation issues and maintains compatibility with the upcoming GCC 14. > > Thanks for the patch! > >> This is my first patch to the kernel, if there are any issues or improvements needed, please let me know. ;) > > It looks OK, a couple nits are that you would normally not put this > line here (in the commit message), but below the --- line (which > means it would not go into the repository). > > In addition, normally you would: wrap your commit messages to a > reasonable length, use scripts/checkpatch.pl to check for this and > other issues, use the "Link" tag instead of "Reference:", avoid > leaving empty lines between tags and ideally use git format-patch > --base to specify the base of your patch (not really needed in many > cases, but it is always nice to have around). > > If you can try that and send a v2, that would be nice. > > But apart from those nits, it seems fine -- welcome! > > Cheers, > Miguel Thanks for your nits, Miguel! I have applied your suggestions and submitted a v2 patch: https://lore.kernel.org/all/20240731034112.6060-1-zehuixu@whu.edu.cn/ --- Cheers, Zehui
On Wed, Jul 31, 2024 at 12:21 AM Zehui Xu <zehuixu@whu.edu.cn> wrote: > > GCC recently added the -fmin-function-alignment option, which will appear in GCC 14. 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, ensuring it is skipped during the bindgen process. This prevents the flag from causing compilation issues and maintains compatibility with the upcoming GCC 14. Thanks for the patch! > This is my first patch to the kernel, if there are any issues or improvements needed, please let me know. ;) It looks OK, a couple nits are that you would normally not put this line here (in the commit message), but below the `---` line (which means it would not go into the repository). In addition, normally you would: wrap your commit messages to a reasonable length, use `scripts/checkpatch.pl` to check for this and other issues, use the "Link" tag instead of "Reference:", avoid leaving empty lines between tags and ideally use `git format-patch --base` to specify the base of your patch (not really needed in many cases, but it is always nice to have around). If you can try that and send a v2, that would be nice. But apart from those nits, it seems fine -- welcome! Cheers, Miguel
© 2016 - 2026 Red Hat, Inc.