> diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
> index a50540ef6521..e9a1a018f270 100644
> --- a/tools/bpf/bpftool/gen.c
> +++ b/tools/bpf/bpftool/gen.c

[ ... ]

> @@ -701,9 +710,9 @@ static void codegen_destroy(struct bpf_object *obj, const 
> char *obj_name)
>               obj_name);
>  }
>
> -static int gen_trace(struct bpf_object *obj, const char *obj_name, const 
> char *header_guard)
> +static int gen_trace(struct bpf_object *obj, const char *obj_name, const 
> char *header_guard,
> +                  const struct gen_loader_opts *opts)
>  {
> -     DECLARE_LIBBPF_OPTS(gen_loader_opts, opts);
>       struct bpf_load_and_run_opts sopts = {};
>       char sig_buf[MAX_SIG_SIZE];
>       __u8 prog_sha[SHA256_DIGEST_LENGTH];
> @@ -712,19 +721,6 @@ static int gen_trace(struct bpf_object *obj, const char 
> *obj_name, const char *h
>       char ident[256];
>       int err = 0;
>
> -     if (sign_progs)
> -             opts.gen_hash = true;
> -
> -     err = bpf_object__gen_loader(obj, &opts);
> -     if (err)
> -             return err;
> -
> -     err = bpf_object__load(obj);
> -     if (err) {
> -             p_err("failed to load object file");
> -             goto out;
> -     }
> -
>       /* If there was no error during load then gen_loader_opts
>        * are populated with the loader program.
>        */

This isn't a bug, but now that the bpf_object__load() call moved to
do_skeleton(), would this comment be clearer next to the new call site, or
reworded as a precondition on the opts parameter? The comment currently sits
at the top of gen_trace() followed immediately by another unrelated comment,
and a reader has to look at the caller to find the load it refers to.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/34311359322

Reply via email to