Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix btf dump error caused by declaration #77

Closed
wants to merge 3 commits into from

Commits on Feb 28, 2022

  1. adding ci files

    Nobody committed Feb 28, 2022
    Configuration menu
    Copy the full SHA
    397ceb4 View commit details
    Browse the repository at this point in the history
  2. 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]>
    Xu Kuohai authored and Nobody committed Feb 28, 2022
    Configuration menu
    Copy the full SHA
    2353840 View commit details
    Browse the repository at this point in the history
  3. selftests/bpf: Update btf_dump case for conflicting names

    Update btf_dump case for conflicting names caused by forward
    declaration.
    
    Signed-off-by: Xu Kuohai <[email protected]>
    Acked-by: Song Liu <[email protected]>
    Xu Kuohai authored and Nobody committed Feb 28, 2022
    Configuration menu
    Copy the full SHA
    1299600 View commit details
    Browse the repository at this point in the history