Re: Build: arm rustgcc unknown argument '-mno-fdpic'

From: Miguel Ojeda
Date: Mon Apr 07 2025 - 15:10:45 EST


On Mon, 07 Apr 2025 22:58:02 +0530 Naresh Kamboju <naresh.kamboju@xxxxxxxxxx> wrote:
>
> Regressions on arm build with config rustgcc-lkftconfig-kselftest on the
> Linux mainline and next failed with CONFIG_RUST=y enabled.

> Bad: next-20250327
> Good: next-20250326

> Unable to generate bindings: clang diagnosed error: error: unknown
> argument: '-mno-fdpic'

I assume this is the arm support, i.e. commit ccb8ce526807 ("ARM: 9441/1:
rust: Enable Rust support for ARMv7").

Clang does not seem to support `-mno-fdpic`, thus you probably need to add it to
`bindgen_skip_c_flags` in `rust/Makefile` so that it gets skipped when the C
compiler is GCC.

If you do so, please double-check if the flag could potentially alter the ABI in
a way that `bindgen` would generate the wrong bindings.

I hope that helps!

Cheers,
Miguel