aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/core_reloc_types.h
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2019-10-15 11:28:49 -0700
committerAlexei Starovoitov <ast@kernel.org>2019-10-15 16:06:05 -0700
commitc7566a69695cd3d8fe876c0da38a03a7472d3f56 (patch)
tree87cf6a2540dbbb1bca6286de1e1c5c06b65f650f /tools/testing/selftests/bpf/progs/core_reloc_types.h
parentlibbpf: Add BPF-side definitions of supported field relocation kinds (diff)
downloadlinux-dev-c7566a69695cd3d8fe876c0da38a03a7472d3f56.tar.xz
linux-dev-c7566a69695cd3d8fe876c0da38a03a7472d3f56.zip
selftests/bpf: Add field existence CO-RE relocs tests
Add a bunch of tests validating CO-RE is handling field existence relocation. Relaxed CO-RE relocation mode is activated for these new tests to prevent libbpf from rejecting BPF object for no-match relocation, even though test BPF program is not going to use that relocation, if field is missing. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20191015182849.3922287-6-andriin@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/progs/core_reloc_types.h')
-rw-r--r--tools/testing/selftests/bpf/progs/core_reloc_types.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/core_reloc_types.h b/tools/testing/selftests/bpf/progs/core_reloc_types.h
index 9a6bdeb4894c..ad763ec0ba8f 100644
--- a/tools/testing/selftests/bpf/progs/core_reloc_types.h
+++ b/tools/testing/selftests/bpf/progs/core_reloc_types.h
@@ -674,3 +674,59 @@ struct core_reloc_misc_extensible {
int c;
int d;
};
+
+/*
+ * EXISTENCE
+ */
+struct core_reloc_existence_output {
+ int a_exists;
+ int a_value;
+ int b_exists;
+ int b_value;
+ int c_exists;
+ int c_value;
+ int arr_exists;
+ int arr_value;
+ int s_exists;
+ int s_value;
+};
+
+struct core_reloc_existence {
+ int a;
+ struct {
+ int b;
+ };
+ int c;
+ int arr[1];
+ struct {
+ int x;
+ } s;
+};
+
+struct core_reloc_existence___minimal {
+ int a;
+};
+
+struct core_reloc_existence___err_wrong_int_sz {
+ short a;
+};
+
+struct core_reloc_existence___err_wrong_int_type {
+ int b[1];
+};
+
+struct core_reloc_existence___err_wrong_int_kind {
+ struct{ int x; } c;
+};
+
+struct core_reloc_existence___err_wrong_arr_kind {
+ int arr;
+};
+
+struct core_reloc_existence___err_wrong_arr_value_type {
+ short arr[1];
+};
+
+struct core_reloc_existence___err_wrong_struct_type {
+ int s;
+};