Skip to content

Commit

Permalink
libbpf: Fix non-C89 loop variable declaration in gen_loader.c
Browse files Browse the repository at this point in the history
Fix the `int i` declaration inside the for statement. This is non-C89
compliant. See [0] for user report breaking BCC build.

  [0] libbpf/libbpf#403

Fixes: 18f4fcc ("libbpf: Update gen_loader to emit BTF_KIND_FUNC relocations")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/bpf/20211105191055.3324874-1-andrii@kernel.org
  • Loading branch information
anakryiko authored and Alexei Starovoitov committed Nov 6, 2021
1 parent be2f2d1 commit b8b5cb5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/lib/bpf/gen_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,9 @@ void bpf_gen__record_extern(struct bpf_gen *gen, const char *name, bool is_weak,
static struct ksym_desc *get_ksym_desc(struct bpf_gen *gen, struct ksym_relo_desc *relo)
{
struct ksym_desc *kdesc;
int i;

for (int i = 0; i < gen->nr_ksyms; i++) {
for (i = 0; i < gen->nr_ksyms; i++) {
if (!strcmp(gen->ksyms[i].name, relo->name)) {
gen->ksyms[i].ref++;
return &gen->ksyms[i];
Expand Down

0 comments on commit b8b5cb5

Please sign in to comment.