[PATCH] D123800: [BPF] handle opaque-pointer for __builtin_preserve_enum_value

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 09:24:55 PDT 2022


yonghong-song added a comment.

In D123800#3452076 <https://reviews.llvm.org/D123800#3452076>, @ast wrote:

> The fix to prevent the crash looks good, but what should be the expected codegen for a global variable?
> CO-RE needs a constant.
> Are we assuming that the global data will be inited with some constant and a later pass will propagate it further into __builtin_preserve,
> so at the end it will become a constant?

Right. These global variables are encoding enum Name/Value information and later the actual generated code for the builtin will be the enum value
as the intrinsic __builtin_preserve_enum_value() returns the enum value, but a relocation record is also generated so libbpf can change
the enum value in the code in case "enum name -> enum value" changed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123800



More information about the llvm-commits mailing list