[PATCH] D73902: [BPF] handle typedef of struct/union for CO-RE relocations

Andrii Nakryiko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 09:47:22 PST 2020


anakryiko added inline comments.
Herald added a subscriber: ormris.


================
Comment at: llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp:715
   // Get type name and calculate the first index.
   // We only want to get type name from structure or union.
   // If user wants a relocation like
----------------
this comment won't be accurate anymore? should it be updated to include typedef?


================
Comment at: llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp:732
 
-    DIType *Ty = stripQualifiers(cast<DIType>(CInfo.Metadata));
+    DIType *PossibleTypeDef = stripQualifiers(cast<DIType>(CInfo.Metadata),
+                                              false);
----------------
I wonder if capturing typedef always is a better approach, even if underlying struct/union is named? If that causes problems due to typedef name not being found, we can always teach libbpf to treat typedef as an alias and try to find candidate types first using typedef name, if that fails - using underlying struct name? WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73902





More information about the llvm-commits mailing list