On Mon, Nov 24, 2025 at 03:55:44PM +0100, Peter Zijlstra wrote:
> On Mon, Nov 24, 2025 at 03:51:46PM +0100, Miguel Ojeda wrote:
> > On Mon, Nov 24, 2025 at 3:47 PM Peter Zijlstra <[email protected]> wrote:
> 
> > By the way, I have had this patch around for RANDSTRUCT a long time:
> > 
> >     
> > https://lore.kernel.org/rust-for-linux/[email protected]/
> > 
> > More than glad if someone confirms it works for them...
> 
> /me mumbles something about using clang to inject C IR into the Rust
> thing and kicking bindgen to the curb :-)

FWIW it might be relatively simple to abuse precompiled headers for
this. Generate the pch files using clang and the normal linux build
flags, then let rust do something like:

  unsafe extern "C" include "header.h.pch"

or whatever fits the syntax best -- some day I'll get around to learning
this thing.

That way you can fairly trivially inject AST/IR from another language --
including all the inline functions and inline asm bits.

Reply via email to