• Andrii Nakryiko's avatar
    btf: resolve enum fwds in btf_dedup · 9768095b
    Andrii Nakryiko authored
    GCC and clang support enum forward declarations as an extension. Such
    forward-declared enums will be represented as normal BTF_KIND_ENUM types with
    vlen=0. This patch adds ability to resolve such enums to their corresponding
    fully defined enums. This helps to avoid duplicated BTF type graphs which only
    differ by some types referencing forward-declared enum vs full enum.
    
    One such example in kernel is enum irqchip_irq_state, defined in
    include/linux/interrupt.h and forward-declared in include/linux/irq.h. This
    causes entire struct task_struct and all referenced types to be duplicated in
    btf_dedup output. This patch eliminates such duplication cases.
    Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    9768095b
btf.c 70.6 KB