On Sat, Apr 19, 2025 at 12:30:01AM +0200, Miguel Ojeda wrote:
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
-mno-fdpic disables a GCC feature that we don't want for kernel builds. clang does not support this feature, so it always behaves as though -mno-fdpic is passed. Therefore, it should be fine to mix the two, at least as far as FDPIC is concerned.
Ben