Re: [PATCH v2] rust: Kbuild: Skip -fmin-function-alignment in bindgen flags

From: Zehui Xu
Date: Wed Jul 31 2024 - 08:48:12 EST


On 7/31/24 13:18, Miguel Ojeda wrote:

> On Wed, Jul 31, 2024 at 5:41 AM Zehui Xu <zehuixu@xxxxxxxxxx> wrote:
>>
>> In addition, since -falign-functions is not used when
>> -fmin-function-alignment is available but skipped and libclang
>> supports -falign-functions, this patch adds it back to the
>> bindgen_extra_c_flags to ensure the intended function alignment
>> is maintained.
>
> Does it change the ABI or could change `bindgen`'s output in a way we care?

You are right, it should not change the ABI or the bindgen output in
a way that affects us, as bindgen only generates .rs Rust bindings and,
after comparison, the generated results are exactly the same with or
without -falign-functions.

> If we do need it, then I think passing `-falign-functions` makes
> sense, since it is the only one that Clang supports and has the same
> behavior as `-fmin-function-alignment` in GCC (i.e. applies it to all
> functions).
>
> If not, then it may be best to avoid unneeded complexity.

Considering this, I will send a patch v3. Thanks!

> Thanks!
>
> Cheers,
> Miguel

Cheers,
Zehui