[all-commits] [llvm/llvm-project] 6d6750: [clang][BPF] support type exist/size and enum exis...
yonghong-song via All-commits
all-commits at lists.llvm.org
Tue Aug 4 08:41:23 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 6d6750696400e7ce988d66a1a00e1d0cb32815f8
https://github.com/llvm/llvm-project/commit/6d6750696400e7ce988d66a1a00e1d0cb32815f8
Author: Yonghong Song <yhs at fb.com>
Date: 2020-08-04 (Tue, 04 Aug 2020)
Changed paths:
M clang/include/clang/Basic/BuiltinsBPF.def
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/lib/Sema/SemaChecking.cpp
A clang/test/CodeGen/builtins-bpf-preserve-field-info-3.c
A clang/test/CodeGen/builtins-bpf-preserve-field-info-4.c
M clang/test/Sema/builtins-bpf.c
M llvm/include/llvm/IR/IntrinsicsBPF.td
Log Message:
-----------
[clang][BPF] support type exist/size and enum exist/value relocations
This patch added the following additional compile-once
run-everywhere (CO-RE) relocations:
- existence/size of typedef, struct/union or enum type
- enum value and enum value existence
These additional relocations will make CO-RE bpf programs more
adaptive for potential kernel internal data structure changes.
For existence/size relocations, the following two code patterns
are supported:
1. uint32_t __builtin_preserve_type_info(*(<type> *)0, flag);
2. <type> var;
uint32_t __builtin_preserve_field_info(var, flag);
flag = 0 for existence relocation and flag = 1 for size relocation.
For enum value existence and enum value relocations, the following code
pattern is supported:
uint64_t __builtin_preserve_enum_value(*(<enum_type> *)<enum_value>,
flag);
flag = 0 means existence relocation and flag = 1 for enum value.
relocation. In the above <enum_type> can be an enum type or
a typedef to enum type. The <enum_value> needs to be an enumerator
value from the same enum type. The return type is uint64_t to
permit potential 64bit enumerator values.
Differential Revision: https://reviews.llvm.org/D83242
More information about the All-commits
mailing list