Re: [PATCH v3 01/11] rust: bindings: Support some inline static functions

From: Alistair Francis
Date: Mon Nov 11 2024 - 17:58:50 EST


On Mon, Nov 11, 2024 at 10:07 PM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>
> "Alistair Francis" <alistair@xxxxxxxxxxxxx> writes:
>
> <cut>
>
> > diff --git a/rust/exports.c b/rust/exports.c
> > index 587f0e776aba..288958d2ebea 100644
> > --- a/rust/exports.c
> > +++ b/rust/exports.c
> > @@ -18,6 +18,7 @@
> > #include "exports_core_generated.h"
> > #include "exports_helpers_generated.h"
> > #include "exports_bindings_generated.h"
> > +#include "exports_bindings_static_generated.h"
>
> Generating `exports_bindings_static_generated.h` depends on `exports.o`,
> which depends on `exports.c`. Does this not create chicken-egg kind of
> problem?

It is a bit confusing as there are a few levels of autogeneration, but
Make happily handles it.

`exports.c` depends on `exports_bindings_static_generated.h`

But `exports_bindings_static_generated.h` depends on `extern.o`
(extern not exports).

`extern.o` then depends on `extern.c`

`extern.c` then depends on `bindings_generated_static.rs`, which is
generated by bindgen.

So there isn't a chick-egg problem and this happily builds from a clean tree.

Alistair

>
> Best regards,
> Andreas Hindborg
>
>