rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gary Guo <gary@garyguo.net>
To: Zehui Xu <zehuixu@whu.edu.cn>
Cc: ojeda@kernel.org, alex.gaynor@gmail.com, wedsonaf@gmail.com,
	boqun.feng@gmail.com, bjorn3_gh@protonmail.com,
	benno.lossin@proton.me, a.hindborg@samsung.com,
	aliceryhl@google.com, rust-for-linux@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] rust: Kbuild: Skip -fmin-function-alignment in bindgen flags
Date: Wed, 7 Aug 2024 11:57:08 +0100	[thread overview]
Message-ID: <20240807115708.394a8eb3@eugeo> (raw)
In-Reply-To: <20240731134346.10630-1-zehuixu@whu.edu.cn>

On Wed, 31 Jul 2024 16:43:46 +0300
Zehui Xu <zehuixu@whu.edu.cn> wrote:

> 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.

This patch itself looks fine to me, so

Reviewed-by: Gary Guo <gary@garyguo.net>

We use -fmin-function-alignment for GCC and use -falign-functions for
clang. These options affect codegen only so it's fine to ignore them
for bindgen.

Although it appears to me that we currently don't set function
alignments for Rust codegen. Maybe that's worth considering adding?

- Gary

> 
> Link: https://lore.kernel.org/linux-kbuild/20240222133500.16991-1-petr.pavlu@suse.com/
> Signed-off-by: Zehui Xu <zehuixu@whu.edu.cn>
> ---
> Since -falign-functions does not affect bindgen output, we do not
> need logic to add it back to the flags. Thanks to the community's
> help, especially Miguel Ojeda. Hope this patch is free of problems
> and can be submitted smoothly : )
> 
> v1:
> * https://lore.kernel.org/all/20240730222053.37066-1-zehuixu@whu.edu.cn/
> 
> v2:
> * Added -falign-functions to bindgen_extra_c_flags when skipping 
>   -fmin-function-alignment to maintain function alignment settings in GCC 14
> * Used reasonable length and moved email content out of the commit message
> * Used "Link" tag instead of "Reference:" and removed empty lines between tags
> * Specified the base commit
> * https://lore.kernel.org/all/20240731034112.6060-1-zehuixu@whu.edu.cn/
> 
> v3:
> * Removed logic from patch v2 which adds -falign-functions
> 
>  rust/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

  parent reply	other threads:[~2024-08-07 10:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 13:43 [PATCH v3] rust: Kbuild: Skip -fmin-function-alignment in bindgen flags Zehui Xu
2024-08-01  9:45 ` Alice Ryhl
2024-08-07  7:52 ` Neal Gompa
2024-08-08  7:37   ` Neal Gompa
2024-08-09 22:06     ` Miguel Ojeda
2024-08-07 10:57 ` Gary Guo [this message]
2024-08-08 15:07   ` Miguel Ojeda
2024-08-13 17:01     ` Gary Guo
2024-08-09 22:10 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240807115708.394a8eb3@eugeo \
    --to=gary@garyguo.net \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    --cc=zehuixu@whu.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).