[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72nPtr1FE_SBU_+wHVptfjnoSGaxjP4LWMzVbOF0M6LvnA@mail.gmail.com>
Date: Sat, 19 Apr 2025 00:30:01 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Ben Wolsieffer <ben.wolsieffer@...ring.com>
Cc: Naresh Kamboju <naresh.kamboju@...aro.org>, Miguel Ojeda <ojeda@...nel.org>,
Christian Schrrefl <chrisi.schrefl@...il.com>, Russell King <rmk+kernel@...linux.org.uk>,
Rudraksha Gupta <guptarud@...il.com>, Alice Ryhl <aliceryhl@...gle.com>,
Ard Biesheuvel <ardb@...nel.org>, anders.roxell@...aro.org, arnd@...db.de,
dan.carpenter@...aro.org, laura.nao@...labora.com,
linux-kernel@...r.kernel.org, lkft-triage@...ts.linaro.org,
regressions@...ts.linux.dev, rust-for-linux@...r.kernel.org,
torvalds@...ux-foundation.org, Nick Clifton <nickc@...hat.com>,
Richard Earnshaw <richard.earnshaw@....com>, Ramana Radhakrishnan <ramanara@...dia.com>
Subject: Re: Build: arm rustgcc unknown argument '-mno-fdpic'
On Fri, Apr 18, 2025 at 9:44 PM Ben Wolsieffer
<ben.wolsieffer@...ring.com> wrote:
>
> FDPIC is only relevant with no-MMU targets, and then only for userspace.
> When configured for the arm-*-uclinuxfdpiceabi target, GCC enables FDPIC
> by default to facilitate compiling userspace programs. FDPIC is never
> used for the kernel, and we pass -mno-fdpic when building the kernel to
> override the default and make sure FDPIC is disabled.
>
> Therefore, it is perfectly safe to omit that flag for kernel builds with
> Clang.
Thanks a lot for the details!
To clarify, this is for GCC kernel builds: skipping the flag is done
for libclang under GCC builds (because `bindgen` always uses libclang,
and `bindgen` is used by Rust to understand C headers).
So GCC will get the flag for the C side of the kernel builds, but
libclang will not get the flag because Clang doesn't recognize it.
Thus, if Clang vs. GCC differ in how they compute the layout of some
type, then we would have an issue "mixing" them.
As you can imagine, GCC kernel builds with Rust enabled are a hack due
to that, and it would be ideal to get `bindgen` to somehow be able to
understand C headers as GCC does:
https://github.com/rust-lang/rust-bindgen/issues/1949
Cheers,
Miguel
Powered by blists - more mailing lists