https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107481

            Bug ID: 107481
           Summary: bpf: add __builtin_preserve_enum_value
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.faust at oracle dot com
  Target Milestone: ---

LLVM supports a builtin:
  __builtin_preserve_enum_value (param, flag)

which is used to generate additional relocations for the
Compile Once - Run Everywhere (CO-RE) mechanism.

This builtin produces a CO-RE relocation recording information
about the enumerator value in 'param' according to 'flag', and
returns that information to the program. For example, the
integer value of the enumerator, or a boolean value representing
whether or not that enumerator exists on the host kernel. These
values are patched by the eBPF loader according to the CO-RE
relocation.

We should support the same functionality in GCC.

These are the relevant changes in LLVM:
  https://reviews.llvm.org/D83878
  https://reviews.llvm.org/D83242

Reply via email to