[PATCH] D83878: BPF: support type exist/size and enum exist/value relocations

Andrii Nakryiko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 12:24:05 PDT 2020


anakryiko added inline comments.


================
Comment at: llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp:901
+    if (CInfo.AccessIndex == BPFCoreSharedInfo::ENUM_VALUE) {
+      PatchImm = getConstant(IntVal);
+    } else {
----------------
shouldn't PatchImm be a 64-bit value?


================
Comment at: llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp:904
+      PatchImm = 1;
+      AccessStrVal = getConstant(IntVal);
+    }
----------------
so if I understand this correctly, access string will encode the integer value of ENUM_VAL, is that right? If yes, that's a bit problematic, because it's ambiguous. Multiple ENUM_VALs can have the same integer value, but we actually want to capture which of those values have to be checked/relocated. Is it possible to record enumerator index, i.e.:

for enum ENUM {
    ENUM_VAL1 = 123,
    ENUM_VAL2 = 123,
}

we record either 0 for ENUM_VAL1 or 1 for ENUM_VAL2, not 123?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83878/new/

https://reviews.llvm.org/D83878



More information about the llvm-commits mailing list