libbpf: Make btf_name_info.needs_size unsigned
PATCH 1/1 libbpf: Make btf_name_info.needs_size unsigned
Clang build of libbpf fails with:
tools/lib/bpf/btf_relocate.c:206:23: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
206 | info[id].needs_size = true;
| ^ ~~~~
Resolve the issue by making needs_size unsigned.
--- tools/lib/bpf/btf_relocate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/btf_relocate.c +1 -1
@@ -58,7 +58,7 @@ struct btf_relocate {struct btf_name_info {const char *name;/* set when search requires a size match */ -int needs_size:1 , +unsigned needs_size:1 , size:31 ;__u32 id; };
Signature · 1 line
2.45.2
Quoted 10 lines · Ilya Leoshkevich
Clang build of libbpf fails with:
tools/lib/bpf/btf_relocate.c:206:23: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
206 | info[id].needs_size = true;
| ^ ~~~~Resolve the issue by making
needs_sizeunsigned.Fixes 19e00c897d50 ("libbpf: Split BTF relocation")Signed-off-by Ilya Leoshkevich <[email protected]>
Thanks for the fix! This one should already be resolved in bpf-next via
0f31c2c61f69 ("libbpf: Fix clang compilation error in btf_relocate.c")
Quoted 17 lines
--- tools/lib/bpf/btf_relocate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/lib/bpf/btf_relocate.c +1
-1@@ -58,7 +58,7 @@ struct btf_relocate {struct btf_name_info {const char *name;/* set when search requires a size match */ -int needs_size:1 , +unsigned needs_size:1 , size:31 ;__u32 id; };