BPF: support type exist/size and enum exist/value relocations
authorYonghong Song <yhs@fb.com>
Thu, 30 Jul 2020 05:46:07 +0000 (22:46 -0700)
committerYonghong Song <yhs@fb.com>
Tue, 4 Aug 2020 19:35:39 +0000 (12:35 -0700)
commit6d218b4adb093ff2e9764febbbc89f429412006c
treef2352b6d9e75396955554151644aad76c326f78a
parent3bfbc5df87cb0e736fe917e4a8d5166bc0b4ea79
BPF: support type exist/size and enum exist/value relocations

Four new CO-RE relocations are introduced:
  - TYPE_EXISTENCE: whether a typedef/record/enum type exists
  - TYPE_SIZE: the size of a typedef/record/enum type
  - ENUM_VALUE_EXISTENCE: whether an enum value of an enum type exists
  - ENUM_VALUE: the enum value of an enum type

These additional relocations will make CO-RE bpf programs
more adaptive for potential kernel internal data structure
changes.

Differential Revision: https://reviews.llvm.org/D83878
llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
llvm/lib/Target/BPF/BPFCORE.h
llvm/lib/Target/BPF/BTFDebug.cpp
llvm/lib/Target/BPF/BTFDebug.h
llvm/test/CodeGen/BPF/CORE/intrinsic-typeinfo-enum-value.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/CORE/intrinsic-typeinfo-type-exist.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/CORE/intrinsic-typeinfo-type-size-1.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/CORE/intrinsic-typeinfo-type-size-2.ll [new file with mode: 0644]