[BPF] Introduce support for type match relocations
authorDaniel Müller <deso@posteo.net>
Thu, 30 Jun 2022 01:20:37 +0000 (18:20 -0700)
committerYonghong Song <yhs@fb.com>
Thu, 30 Jun 2022 01:23:08 +0000 (18:23 -0700)
commitd129ac27e872e189363e3d8cd6bc4e2152cd73ec
treea35b06f6f4f19cb4b4325c7d9ec84dc82787b6e6
parent72cd6b6c8356757c3f38bf91fb7a22f28bfb891e
[BPF] Introduce support for type match relocations

Among others, BPF currently supports the type-exists CO-RE relocation
(e.g., see D83878 & D83242). Its intention, as the name tries to convey,
is to be used for checking existence of a type in a target.
While that check is useful and has its place, we would also like to
be able to perform stricter type queries: instead of just checking mere
existence, we want to make sure that members match up in composite
types, that enum variants are present, etc. We refer to this as "type
match".

This change proposes the addition of a new relocation variant/value that
we intend to use for establishing this match relation.

Differential Revision: https://reviews.llvm.org/D126838
llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
llvm/lib/Target/BPF/BPFCORE.h
llvm/test/CodeGen/BPF/CORE/intrinsic-typeinfo-type-match.ll [new file with mode: 0644]