Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libbpf: Skip forward declaration when counting duplicated type names
Currently if a declaration appears in the BTF before the definition, the definition is dumped as a conflicting name, eg: $ bpftool btf dump file vmlinux format raw | grep "'unix_sock'" [81287] FWD 'unix_sock' fwd_kind=struct [89336] STRUCT 'unix_sock' size=1024 vlen=14 $ bpftool btf dump file vmlinux format c | grep "struct unix_sock" struct unix_sock; struct unix_sock___2 { <--- conflict, the "___2" is unexpected struct unix_sock___2 *unix_sk; This causes a compilation error if the dump output is used as a header file. Fix it by skipping declaration when counting duplicated type names. Fixes: 351131b ("libbpf: add btf_dump API for BTF-to-C conversion") Signed-off-by: Xu Kuohai <[email protected]> Acked-by: Song Liu <[email protected]>
- Loading branch information