Skip to content

Commit 7c3977d

Browse files
author
Alexei Starovoitov
committed
libbpf: Fix sym->st_value print on 32-bit arches
The st_value field is a 64-bit value and causing this error on 32-bit arches: In file included from libbpf.c:52: libbpf.c: In function 'bpf_program__record_reloc': libbpf_internal.h:59:22: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'Elf64_Addr' {aka 'const long long unsigned int'} [-Werror=format=] Fix it with (__u64) cast. Fixes: 1f8e2bc ("libbpf: Refactor relocation handling") Reported-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 1fd450f commit 7c3977d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ static int bpf_program__record_reloc(struct bpf_program *prog,
18171817
return -LIBBPF_ERRNO__RELOC;
18181818
}
18191819
if (sym->st_value % 8) {
1820-
pr_warn("bad call relo offset: %lu\n", sym->st_value);
1820+
pr_warn("bad call relo offset: %llu\n", (__u64)sym->st_value);
18211821
return -LIBBPF_ERRNO__RELOC;
18221822
}
18231823
reloc_desc->type = RELO_CALL;

0 commit comments

Comments
 (0)