7 struct core_reloc_kernel_output {
9 char comm[sizeof("test_progs")];
16 struct core_reloc_flavors {
22 /* this is not a flavor, as it doesn't have triple underscore */
23 struct core_reloc_flavors__err_wrong_name {
32 /* original set up, used to record relocations in BPF program */
33 struct core_reloc_nesting_substruct {
37 union core_reloc_nesting_subunion {
41 struct core_reloc_nesting {
43 struct core_reloc_nesting_substruct a;
46 union core_reloc_nesting_subunion b;
50 /* inlined anonymous struct/union instead of named structs in original */
51 struct core_reloc_nesting___anon_embed {
52 int __just_for_padding;
65 /* different mix of nested structs/unions than in original */
66 struct core_reloc_nesting___struct_union_mixup {
85 /* extra anon structs/unions, but still valid a.a.a and b.b.b accessors */
86 struct core_reloc_nesting___extra_nesting {
113 /* three flavors of same struct with different structure but same layout for
114 * a.a.a and b.b.b, thus successfully resolved and relocatable */
115 struct core_reloc_nesting___dup_compat_types {
116 char __just_for_padding;
117 /* 3 more bytes of padding */
120 int a; /* offset 4 */
123 long long __more_padding;
126 int b; /* offset 16 */
131 struct core_reloc_nesting___dup_compat_types__2 {
132 int __aligned_padding;
134 int __trickier_noop[0];
136 char __some_more_noops[0];
137 int a; /* offset 4 */
144 int __critical_padding;
145 int b; /* offset 16 */
147 int __does_not_matter;
150 int __more_irrelevant_stuff;
153 struct core_reloc_nesting___dup_compat_types__3 {
154 char __correct_padding[4];
157 int a; /* offset 4 */
160 /* 8 byte padding due to next struct's alignment */
165 } b __attribute__((aligned(16)));
168 /* b.b.b field is missing */
169 struct core_reloc_nesting___err_missing_field {
182 /* b.b.b field is an array of integers instead of plain int */
183 struct core_reloc_nesting___err_array_field {
196 /* middle b container is missing */
197 struct core_reloc_nesting___err_missing_container {
208 /* middle b container is referenced through pointer instead of being embedded */
209 struct core_reloc_nesting___err_nonstruct_container {
222 /* middle b container is an array of structs instead of plain struct */
223 struct core_reloc_nesting___err_array_container {
236 /* two flavors of same struct with incompatible layout for b.b.b */
237 struct core_reloc_nesting___err_dup_incompat_types__1 {
240 int a; /* offset 0 */
245 int b; /* offset 4 */
250 struct core_reloc_nesting___err_dup_incompat_types__2 {
253 int a; /* offset 0 */
259 int b; /* offset 8 (!) */
264 /* two flavors of same struct having one of a.a.a and b.b.b, but not both */
265 struct core_reloc_nesting___err_partial_match_dups__a {
273 struct core_reloc_nesting___err_partial_match_dups__b {
281 struct core_reloc_nesting___err_too_deep {
287 /* 65 levels of nestedness for b.b.b */
290 struct { struct { struct { struct { struct {
291 struct { struct { struct { struct { struct {
292 struct { struct { struct { struct { struct {
293 struct { struct { struct { struct { struct {
294 struct { struct { struct { struct { struct {
295 struct { struct { struct { struct { struct {
296 struct { struct { struct { struct { struct {
297 struct { struct { struct { struct { struct {
298 struct { struct { struct { struct { struct {
299 struct { struct { struct { struct { struct {
300 struct { struct { struct { struct { struct {
301 struct { struct { struct { struct { struct {
302 /* this one is one too much */
325 struct core_reloc_arrays_output {
333 struct core_reloc_arrays_substruct {
338 struct core_reloc_arrays {
341 struct core_reloc_arrays_substruct c[3];
342 struct core_reloc_arrays_substruct d[1][2];
343 struct core_reloc_arrays_substruct f[][2];
346 /* bigger array dimensions */
347 struct core_reloc_arrays___diff_arr_dim {
350 struct core_reloc_arrays_substruct c[4];
351 struct core_reloc_arrays_substruct d[2][3];
352 struct core_reloc_arrays_substruct f[1][3];
355 /* different size of array's value (struct) */
356 struct core_reloc_arrays___diff_arr_val_sz {
376 struct core_reloc_arrays___equiv_zero_sz_arr {
379 struct core_reloc_arrays_substruct c[3];
380 struct core_reloc_arrays_substruct d[1][2];
381 /* equivalent to flexible array */
382 struct core_reloc_arrays_substruct f[][2];
385 struct core_reloc_arrays___fixed_arr {
388 struct core_reloc_arrays_substruct c[3];
389 struct core_reloc_arrays_substruct d[1][2];
390 /* not a flexible array anymore, but within access bounds */
391 struct core_reloc_arrays_substruct f[1][2];
394 struct core_reloc_arrays___err_too_small {
395 int a[2]; /* this one is too small */
397 struct core_reloc_arrays_substruct c[3];
398 struct core_reloc_arrays_substruct d[1][2];
399 struct core_reloc_arrays_substruct f[][2];
402 struct core_reloc_arrays___err_too_shallow {
404 char b[2][3]; /* this one lacks one dimension */
405 struct core_reloc_arrays_substruct c[3];
406 struct core_reloc_arrays_substruct d[1][2];
407 struct core_reloc_arrays_substruct f[][2];
410 struct core_reloc_arrays___err_non_array {
411 int a; /* not an array */
413 struct core_reloc_arrays_substruct c[3];
414 struct core_reloc_arrays_substruct d[1][2];
415 struct core_reloc_arrays_substruct f[][2];
418 struct core_reloc_arrays___err_wrong_val_type {
421 int c[3]; /* value is not a struct */
422 struct core_reloc_arrays_substruct d[1][2];
423 struct core_reloc_arrays_substruct f[][2];
426 struct core_reloc_arrays___err_bad_zero_sz_arr {
427 /* zero-sized array, but not at the end */
428 struct core_reloc_arrays_substruct f[0][2];
431 struct core_reloc_arrays_substruct c[3];
432 struct core_reloc_arrays_substruct d[1][2];
438 enum core_reloc_primitives_enum {
443 struct core_reloc_primitives {
446 enum core_reloc_primitives_enum c;
448 int (*f)(const char *);
451 struct core_reloc_primitives___diff_enum_def {
455 int (*f)(const char *);
459 } c; /* inline enum def with differing set of values */
462 struct core_reloc_primitives___diff_func_proto {
463 void (*f)(int); /* incompatible function prototype */
465 enum core_reloc_primitives_enum c;
470 struct core_reloc_primitives___diff_ptr_type {
471 const char * const d; /* different pointee type + modifiers */
474 enum core_reloc_primitives_enum c;
475 int (*f)(const char *);
478 struct core_reloc_primitives___err_non_enum {
481 int c; /* int instead of enum */
483 int (*f)(const char *);
486 struct core_reloc_primitives___err_non_int {
488 int *b; /* ptr instead of int */
489 enum core_reloc_primitives_enum c;
491 int (*f)(const char *);
494 struct core_reloc_primitives___err_non_ptr {
497 enum core_reloc_primitives_enum c;
498 int d; /* int instead of ptr */
499 int (*f)(const char *);
505 struct core_reloc_mods_output {
506 int a, b, c, d, e, f, g, h;
509 typedef const int int_t;
510 typedef const char *char_ptr_t;
511 typedef const int arr_t[7];
513 struct core_reloc_mods_substruct {
521 } core_reloc_mods_substruct_t;
523 struct core_reloc_mods {
530 struct core_reloc_mods_substruct g;
531 core_reloc_mods_substruct_t h;
534 /* a/b, c/d, e/f, and g/h pairs are swapped */
535 struct core_reloc_mods___mod_swap {
546 core_reloc_mods_substruct_t g;
550 typedef int1_t int2_t;
551 typedef int2_t int3_t;
553 typedef int arr1_t[5];
554 typedef arr1_t arr2_t;
555 typedef arr2_t arr3_t;
556 typedef arr3_t arr4_t;
558 typedef const char * const volatile fancy_char_ptr_t;
560 typedef core_reloc_mods_substruct_t core_reloc_mods_substruct_tt;
562 /* we need more typedefs */
563 struct core_reloc_mods___typedefs {
564 core_reloc_mods_substruct_tt g;
565 core_reloc_mods_substruct_tt h;
577 struct core_reloc_ptr_as_arr {
581 struct core_reloc_ptr_as_arr___diff_sz {
582 int :32; /* padding */
583 char __some_more_padding;
590 struct core_reloc_ints {
601 /* signed/unsigned types swap */
602 struct core_reloc_ints___reverse_sign {
613 struct core_reloc_ints___bool {
614 bool u8_field; /* bool instead of uint8 */
627 struct core_reloc_misc_output {
631 struct core_reloc_misc___a {
636 struct core_reloc_misc___b {
641 /* this one extends core_reloc_misc_extensible struct from BPF prog */
642 struct core_reloc_misc_extensible {
652 struct core_reloc_existence_output {
665 struct core_reloc_existence {
677 struct core_reloc_existence___minimal {
681 struct core_reloc_existence___err_wrong_int_sz {
685 struct core_reloc_existence___err_wrong_int_type {
689 struct core_reloc_existence___err_wrong_int_kind {
693 struct core_reloc_existence___err_wrong_arr_kind {
697 struct core_reloc_existence___err_wrong_arr_value_type {
701 struct core_reloc_existence___err_wrong_struct_type {
708 /* bitfield read results, all as plain integers */
709 struct core_reloc_bitfields_output {
719 struct core_reloc_bitfields {
720 /* unsigned bitfields */
724 /* signed bitfields */
732 /* different bit sizes (both up and down) */
733 struct core_reloc_bitfields___bit_sz_change {
734 /* unsigned bitfields */
735 uint16_t ub1: 3; /* 1 -> 3 */
736 uint32_t ub2: 20; /* 2 -> 20 */
737 uint8_t ub7: 1; /* 7 -> 1 */
738 /* signed bitfields */
739 int8_t sb4: 1; /* 4 -> 1 */
740 int32_t sb20: 30; /* 20 -> 30 */
742 uint16_t u32; /* 32 -> 16 */
743 int64_t s32; /* 32 -> 64 */
746 /* turn bitfield into non-bitfield and vice versa */
747 struct core_reloc_bitfields___bitfield_vs_int {
748 uint64_t ub1; /* 3 -> 64 non-bitfield */
749 uint8_t ub2; /* 20 -> 8 non-bitfield */
750 int64_t ub7; /* 7 -> 64 non-bitfield signed */
751 int64_t sb4; /* 4 -> 64 non-bitfield signed */
752 uint64_t sb20; /* 20 -> 16 non-bitfield unsigned */
753 int32_t u32: 20; /* 32 non-bitfield -> 20 bitfield */
754 uint64_t s32: 60; /* 32 non-bitfield -> 60 bitfield */
757 struct core_reloc_bitfields___just_big_enough {
759 uint64_t ub2: 60; /* packed tightly */
765 } __attribute__((packed)) ;
767 struct core_reloc_bitfields___err_too_big_bitfield {
769 uint64_t ub2: 61; /* packed tightly */
775 } __attribute__((packed)) ;
780 struct core_reloc_size_output {
790 struct core_reloc_size {
792 struct { int x; } struct_field;
793 union { int x; } union_field;
796 enum { VALUE = 123 } enum_field;
799 struct core_reloc_size___diff_sz {
801 struct { int x; int y; int z; } struct_field;
802 union { int x; char bla[123]; } union_field;
805 enum { OTHER_VALUE = 0xFFFFFFFFFFFFFFFF } enum_field;