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
{
332 struct core_reloc_arrays_substruct
{
337 struct core_reloc_arrays
{
340 struct core_reloc_arrays_substruct c
[3];
341 struct core_reloc_arrays_substruct d
[1][2];
344 /* bigger array dimensions */
345 struct core_reloc_arrays___diff_arr_dim
{
348 struct core_reloc_arrays_substruct c
[4];
349 struct core_reloc_arrays_substruct d
[2][3];
352 /* different size of array's value (struct) */
353 struct core_reloc_arrays___diff_arr_val_sz
{
368 struct core_reloc_arrays___err_too_small
{
369 int a
[2]; /* this one is too small */
371 struct core_reloc_arrays_substruct c
[3];
372 struct core_reloc_arrays_substruct d
[1][2];
375 struct core_reloc_arrays___err_too_shallow
{
377 char b
[2][3]; /* this one lacks one dimension */
378 struct core_reloc_arrays_substruct c
[3];
379 struct core_reloc_arrays_substruct d
[1][2];
382 struct core_reloc_arrays___err_non_array
{
383 int a
; /* not an array */
385 struct core_reloc_arrays_substruct c
[3];
386 struct core_reloc_arrays_substruct d
[1][2];
389 struct core_reloc_arrays___err_wrong_val_type
{
392 int c
[3]; /* value is not a struct */
393 struct core_reloc_arrays_substruct d
[1][2];
399 enum core_reloc_primitives_enum
{
404 struct core_reloc_primitives
{
407 enum core_reloc_primitives_enum c
;
409 int (*f
)(const char *);
412 struct core_reloc_primitives___diff_enum_def
{
416 int (*f
)(const char *);
420 } c
; /* inline enum def with differing set of values */
423 struct core_reloc_primitives___diff_func_proto
{
424 void (*f
)(int); /* incompatible function prototype */
426 enum core_reloc_primitives_enum c
;
431 struct core_reloc_primitives___diff_ptr_type
{
432 const char * const d
; /* different pointee type + modifiers */
435 enum core_reloc_primitives_enum c
;
436 int (*f
)(const char *);
439 struct core_reloc_primitives___err_non_enum
{
442 int c
; /* int instead of enum */
444 int (*f
)(const char *);
447 struct core_reloc_primitives___err_non_int
{
449 int *b
; /* ptr instead of int */
450 enum core_reloc_primitives_enum c
;
452 int (*f
)(const char *);
455 struct core_reloc_primitives___err_non_ptr
{
458 enum core_reloc_primitives_enum c
;
459 int d
; /* int instead of ptr */
460 int (*f
)(const char *);
466 struct core_reloc_mods_output
{
467 int a
, b
, c
, d
, e
, f
, g
, h
;
470 typedef const int int_t
;
471 typedef const char *char_ptr_t
;
472 typedef const int arr_t
[7];
474 struct core_reloc_mods_substruct
{
482 } core_reloc_mods_substruct_t
;
484 struct core_reloc_mods
{
491 struct core_reloc_mods_substruct g
;
492 core_reloc_mods_substruct_t h
;
495 /* a/b, c/d, e/f, and g/h pairs are swapped */
496 struct core_reloc_mods___mod_swap
{
507 core_reloc_mods_substruct_t g
;
511 typedef int1_t int2_t
;
512 typedef int2_t int3_t
;
514 typedef int arr1_t
[5];
515 typedef arr1_t arr2_t
;
516 typedef arr2_t arr3_t
;
517 typedef arr3_t arr4_t
;
519 typedef const char * const volatile fancy_char_ptr_t
;
521 typedef core_reloc_mods_substruct_t core_reloc_mods_substruct_tt
;
523 /* we need more typedefs */
524 struct core_reloc_mods___typedefs
{
525 core_reloc_mods_substruct_tt g
;
526 core_reloc_mods_substruct_tt h
;
538 struct core_reloc_ptr_as_arr
{
542 struct core_reloc_ptr_as_arr___diff_sz
{
543 int :32; /* padding */
544 char __some_more_padding
;
551 struct core_reloc_ints
{
562 /* signed/unsigned types swap */
563 struct core_reloc_ints___reverse_sign
{
574 struct core_reloc_ints___bool
{
575 bool u8_field
; /* bool instead of uint8 */
588 struct core_reloc_misc_output
{
592 struct core_reloc_misc___a
{
597 struct core_reloc_misc___b
{
602 /* this one extends core_reloc_misc_extensible struct from BPF prog */
603 struct core_reloc_misc_extensible
{
613 struct core_reloc_existence_output
{
626 struct core_reloc_existence
{
638 struct core_reloc_existence___minimal
{
642 struct core_reloc_existence___err_wrong_int_sz
{
646 struct core_reloc_existence___err_wrong_int_type
{
650 struct core_reloc_existence___err_wrong_int_kind
{
654 struct core_reloc_existence___err_wrong_arr_kind
{
658 struct core_reloc_existence___err_wrong_arr_value_type
{
662 struct core_reloc_existence___err_wrong_struct_type
{
669 /* bitfield read results, all as plain integers */
670 struct core_reloc_bitfields_output
{
680 struct core_reloc_bitfields
{
681 /* unsigned bitfields */
685 /* signed bitfields */
693 /* different bit sizes (both up and down) */
694 struct core_reloc_bitfields___bit_sz_change
{
695 /* unsigned bitfields */
696 uint16_t ub1
: 3; /* 1 -> 3 */
697 uint32_t ub2
: 20; /* 2 -> 20 */
698 uint8_t ub7
: 1; /* 7 -> 1 */
699 /* signed bitfields */
700 int8_t sb4
: 1; /* 4 -> 1 */
701 int32_t sb20
: 30; /* 20 -> 30 */
703 uint16_t u32
; /* 32 -> 16 */
704 int64_t s32
; /* 32 -> 64 */
707 /* turn bitfield into non-bitfield and vice versa */
708 struct core_reloc_bitfields___bitfield_vs_int
{
709 uint64_t ub1
; /* 3 -> 64 non-bitfield */
710 uint8_t ub2
; /* 20 -> 8 non-bitfield */
711 int64_t ub7
; /* 7 -> 64 non-bitfield signed */
712 int64_t sb4
; /* 4 -> 64 non-bitfield signed */
713 uint64_t sb20
; /* 20 -> 16 non-bitfield unsigned */
714 int32_t u32
: 20; /* 32 non-bitfield -> 20 bitfield */
715 uint64_t s32
: 60; /* 32 non-bitfield -> 60 bitfield */
718 struct core_reloc_bitfields___just_big_enough
{
720 uint64_t ub2
: 60; /* packed tightly */
726 } __attribute__((packed
)) ;
728 struct core_reloc_bitfields___err_too_big_bitfield
{
730 uint64_t ub2
: 61; /* packed tightly */
736 } __attribute__((packed
)) ;
741 struct core_reloc_size_output
{
751 struct core_reloc_size
{
753 struct { int x
; } struct_field
;
754 union { int x
; } union_field
;
757 enum { VALUE
= 123 } enum_field
;
760 struct core_reloc_size___diff_sz
{
762 struct { int x
; int y
; int z
; } struct_field
;
763 union { int x
; char bla
[123]; } union_field
;
766 enum { OTHER_VALUE
= 0xFFFFFFFFFFFFFFFF } enum_field
;