• Yonghong Song's avatar
    bpf: btf: support 128 bit integer type · b1e8818c
    Yonghong Song authored
    Currently, btf only supports up to 64-bit integer.
    On the other hand, 128bit support for gcc and clang
    has existed for a long time. For example, both gcc 4.8
    and llvm 3.7 supports types "__int128" and
    "unsigned __int128" for virtually all 64bit architectures
    including bpf.
    
    The requirement for __int128 support comes from two areas:
      . bpf program may use __int128. For example, some bcc tools
        (https://github.com/iovisor/bcc/tree/master/tools),
        mostly tcp v6 related, tcpstates.py, tcpaccept.py, etc.,
        are using __int128 to represent the ipv6 addresses.
      . linux itself is using __int128 types. Hence supporting
        __int128 type in BTF is required for vmlinux BTF,
        which will be used by "compile once and run everywhere"
        and other projects.
    
    For 128bit integer, instead of base-10, hex numbers are pretty
    printed out as large decimal number is hard to decipher, e.g.,
    for ipv6 addresses.
    Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    b1e8818c
btf.c 76.5 KB