On Fri, 7 Nov 2025 17:33:08 +0000
Marat Khalili <[email protected]> wrote:
> > +/*
> > + * Test BPF function that will be loaded from ELF
> > + * This function:
> > + * 1. Reads values from input structure
> > + * 2. Performs some computations
> > + * 3. Writes results to output structure
> > + * 4. Returns sum of values
> > + */
> > +__attribute__((section("func"), used))
>
> Do we need `used` here and in other section attributes? I do not thing `clang
> -c` will eliminate non-static/inline functions from the object file, or maybe
> I
> don't understand the purpose (perhaps needs a comment).
>
> > +uint64_t
> > +test_func(struct dummy_vect8 *arg)
The BPF loader in DPDK uses section names as the way to find functions.
The original version of this code was autogenerated off of examples used
in kernel BPF.