Lines Matching +full:1 +full:- +full:4

1 /* SPDX-License-Identifier: GPL-2.0 */
100 * int q[4][8];
105 .descr = "struct test #1",
108 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
112 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
114 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
118 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
120 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
121 BTF_MEMBER_ENC(NAME_TBD, 6, 384),/* int q[4][8] */
124 /* int[4][8] */
125 BTF_TYPE_ARRAY_ENC(4, 1, 4), /* [6] */
129 BTF_ENUM_ENC(NAME_TBD, 1),
138 .key_type_id = 1,
140 .max_entries = 4,
147 * struct b n[4];
148 * const Struct_B o[4];
159 /* int */ /* [1] */
160 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
161 /* struct b [4] */ /* [2] */
162 BTF_TYPE_ARRAY_ENC(4, 1, 4),
166 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int m; */
167 BTF_MEMBER_ENC(NAME_TBD, 2, 32),/* struct B n[4] */
168 BTF_MEMBER_ENC(NAME_TBD, 8, 288),/* const Struct_B o[4];*/
171 /* struct B { */ /* [4] */
173 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int m; */
174 BTF_MEMBER_ENC(NAME_TBD, 1, 32),/* int n; */
178 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 1),
180 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_TYPEDEF, 0, 0), 4),
183 /* const Struct_B [4] */ /* [8] */
184 BTF_TYPE_ARRAY_ENC(7, 1, 4),
193 .key_type_id = 1,
195 .max_entries = 4,
200 /* int */ /* [1] */
201 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
207 BTF_MEMBER_ENC(NAME_TBD, 1, 64), /* int m; */
218 .key_type_id = 1,
220 .max_entries = 4,
234 .descr = "global data test #1",
237 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
241 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
243 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
245 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 4), 48),
247 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
249 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
259 .key_type_id = 1,
261 .max_entries = 4,
271 * static struct A t; <- in .bss
277 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
281 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
283 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
285 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 4), 48),
287 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
289 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
294 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 48),
306 .max_entries = 1,
312 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
314 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
316 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
317 BTF_VAR_SECINFO_ENC(2, 0, 4),
325 .value_size = 4,
328 .max_entries = 1,
331 .descr = "global data test #4, unsupported linkage",
334 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
336 BTF_VAR_ENC(NAME_TBD, 1, 2), /* [2] */
338 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
339 BTF_VAR_SECINFO_ENC(2, 0, 4),
347 .value_size = 4,
350 .max_entries = 1,
358 BTF_VAR_ENC(NAME_TBD, 0, 0), /* [1] */
360 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
361 BTF_VAR_SECINFO_ENC(1, 0, 4),
369 .value_size = 4,
372 .max_entries = 1,
381 BTF_INFO_ENC(BTF_KIND_FWD, 1, 0), 0), /* [1] */
383 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
385 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
386 BTF_VAR_SECINFO_ENC(2, 0, 4),
394 .value_size = 4,
397 .max_entries = 1,
406 BTF_INFO_ENC(BTF_KIND_FWD, 1, 0), 0), /* [1] */
408 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
410 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
411 BTF_VAR_SECINFO_ENC(1, 0, 4),
419 .value_size = 4,
422 .max_entries = 1,
430 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
434 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
436 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
438 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 4), 48),
440 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
442 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
447 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 48),
459 .max_entries = 1,
467 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
471 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
473 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
475 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 4), 48),
477 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
479 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
484 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 46),
496 .max_entries = 1,
504 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
508 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
510 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
512 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 4), 48),
514 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
516 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
521 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 46),
533 .max_entries = 1,
541 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
545 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
547 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
549 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 4), 48),
551 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
553 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
558 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [7] */
562 BTF_VAR_SECINFO_ENC(7, 58, 4),
573 .max_entries = 1,
579 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
583 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
585 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
587 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 4), 48),
589 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
591 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
596 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [7] */
600 BTF_VAR_SECINFO_ENC(7, 60, 4),
611 .max_entries = 1,
619 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
623 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
625 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
627 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 4), 48),
629 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
631 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
636 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [7] */
640 BTF_VAR_SECINFO_ENC(7, 12, 4),
651 .max_entries = 1,
659 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
663 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1), /* [3] */
665 BTF_TYPE_ARRAY_ENC(1, 1, 8), /* [4] */
667 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 4), 48),
669 BTF_MEMBER_ENC(NAME_TBD, 1, 64),/* int n; */
671 BTF_MEMBER_ENC(NAME_TBD, 4, 128),/* int p[8] */
676 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [7] */
679 BTF_VAR_SECINFO_ENC(7, 58, 4),
691 .max_entries = 1,
699 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
700 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
702 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
703 BTF_VAR_SECINFO_ENC(1, 0, 4),
711 .value_size = 4,
714 .max_entries = 1,
722 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
725 /* a section */ /* [4] */
726 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
727 BTF_VAR_SECINFO_ENC(3, 0, 4),
729 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
730 BTF_VAR_SECINFO_ENC(6, 0, 4),
731 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [6] */
739 .value_size = 4,
741 .value_type_id = 4,
742 .max_entries = 1,
750 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
751 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
753 /* a section */ /* [4] */
754 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
755 BTF_VAR_SECINFO_ENC(3, 0, 4),
763 .value_size = 4,
765 .value_type_id = 4,
766 .max_entries = 1,
774 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
777 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
778 BTF_VAR_SECINFO_ENC(2, 0, 4),
786 .value_size = 4,
788 .value_type_id = 4,
789 .max_entries = 1,
797 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
799 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [3] */
807 .value_size = 4,
809 .value_type_id = 4,
810 .max_entries = 1,
818 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
821 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [3] */
829 .value_size = 4,
831 .value_type_id = 4,
832 .max_entries = 1,
840 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
843 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int m; */
846 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [3] */
854 .value_size = 4,
856 .value_type_id = 4,
857 .max_entries = 1,
865 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
866 BTF_TYPE_ARRAY_ENC(3, 1, 4), /* [2] */
867 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [3] */
875 .value_size = 4,
877 .value_type_id = 4,
878 .max_entries = 1,
885 /* .bss section */ /* [1] */
887 sizeof(void*)+4),
888 BTF_VAR_SECINFO_ENC(4, 0, sizeof(void*)),
889 BTF_VAR_SECINFO_ENC(6, sizeof(void*), 4),
891 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
894 BTF_VAR_ENC(NAME_TBD, 3, 0), /* [4] */
905 .value_size = sizeof(void*)+4,
907 .value_type_id = 1,
908 .max_entries = 1,
918 .descr = "size check test #1",
920 /* int */ /* [1] */
921 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
923 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 2), sizeof(int) * 2 - 1),
924 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int m; */
925 BTF_MEMBER_ENC(NAME_TBD, 1, 32),/* int n; */
934 .value_size = 1,
935 .key_type_id = 1,
937 .max_entries = 4,
952 /* int */ /* [1] */
955 BTF_TYPE_ARRAY_ENC(1, 1, 2),
957 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 2), sizeof(int) * 3 - 1),
958 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int m; */
968 .value_size = 1,
969 .key_type_id = 1,
971 .max_entries = 4,
986 /* int */ /* [1] */
991 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 2), sizeof(int) + sizeof(void *) - 1),
992 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int m; */
1002 .value_size = 1,
1003 .key_type_id = 1,
1005 .max_entries = 4,
1023 .descr = "size check test #4",
1025 /* int */ /* [1] */
1030 BTF_ENUM_ENC(NAME_TBD, 1),
1033 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 2), sizeof(int) * 2 - 1),
1034 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int m; */
1044 .value_size = 1,
1045 .key_type_id = 1,
1047 .max_entries = 4,
1067 /* int */ /* [1] */
1070 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 8, 1),
1072 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 2), 1),
1074 BTF_ENUM_ENC(NAME_TBD, 1),
1076 /* struct A { */ /* [4] */
1089 .key_type_id = 1,
1090 .value_type_id = 4,
1091 .max_entries = 4,
1100 .descr = "void test #1",
1102 /* int */ /* [1] */
1103 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1109 BTF_TYPEDEF_ENC(NAME_TBD, 3), /* [4] */
1111 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), sizeof(void *)),
1113 BTF_MEMBER_ENC(NAME_TBD, 4, 0),
1123 .key_type_id = 1,
1124 .value_type_id = 4,
1125 .max_entries = 4,
1135 /* int */ /* [1] */
1136 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1140 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), 8),
1152 .key_type_id = 1,
1154 .max_entries = 4,
1160 * const_void_ptr[4]
1165 /* int */ /* [1] */
1166 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1172 BTF_TYPEDEF_ENC(NAME_TBD, 3), /* [4] */
1173 /* const_void_ptr[4] */
1174 BTF_TYPE_ARRAY_ENC(4, 1, 4), /* [5] */
1182 .value_size = sizeof(void *) * 4,
1183 .key_type_id = 1,
1185 .max_entries = 4,
1188 /* const void[4] */
1190 .descr = "void test #4",
1192 /* int */ /* [1] */
1193 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1196 /* const void[4] */ /* [3] */
1197 BTF_TYPE_ARRAY_ENC(2, 1, 4),
1205 .value_size = sizeof(void *) * 4,
1206 .key_type_id = 1,
1208 .max_entries = 4,
1213 /* Array_A <------------------+
1217 * Array_B <-------- + |
1218 * elem_type == Array A --+
1221 .descr = "loop test #1",
1223 /* int */ /* [1] */
1224 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1226 BTF_TYPE_ARRAY_ENC(3, 1, 8),
1228 BTF_TYPE_ARRAY_ENC(2, 1, 8),
1237 .key_type_id = 1,
1239 .max_entries = 4,
1248 * Array_A <------------------+
1252 * Array_B <-------- + |
1253 * elem_type == Array_A --+
1259 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
1261 BTF_TYPEDEF_ENC(1, 4), /* [2] */
1263 BTF_TYPE_ARRAY_ENC(2, 1, 8), /* [3] */
1265 BTF_TYPE_ARRAY_ENC(3, 1, 8), /* [4] */
1274 .key_type_id = 1,
1276 .max_entries = 4,
1281 /* Array_A <------------------+
1285 * Array_B <-------- + |
1286 * elem_type == Array_A --+
1291 /* int */ /* [1] */
1292 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1294 BTF_TYPE_ARRAY_ENC(3, 1, 8),
1296 BTF_TYPE_ARRAY_ENC(2, 1, 8),
1305 .key_type_id = 1,
1307 .max_entries = 4,
1316 * Array_A <------------------+
1320 * Array_B <-------- + |
1321 * elem_type == Array_A --+
1324 .descr = "loop test #4",
1326 /* int */ /* [1] */
1327 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1329 BTF_TYPE_ARRAY_ENC(3, 1, 8),
1331 BTF_TYPEDEF_ENC(NAME_TBD, 4),
1332 /* Array_B */ /* [4] */
1333 BTF_TYPE_ARRAY_ENC(2, 1, 8),
1342 .key_type_id = 1,
1344 .max_entries = 4,
1365 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
1368 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int x; */
1371 BTF_TYPEDEF_ENC(NAME_TBD, 4), /* [3] */
1372 /* struct B */ /* [4] */
1374 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int x; */
1384 .key_type_id = 1,
1386 .max_entries = 4,
1393 * struct A array_a[4];
1400 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
1401 BTF_TYPE_ARRAY_ENC(3, 1, 4), /* [2] */
1404 BTF_MEMBER_ENC(NAME_TBD, 1, 0), /* int x; */
1405 BTF_MEMBER_ENC(NAME_TBD, 2, 32),/* struct A array_a[4]; */
1414 .key_type_id = 1,
1416 .max_entries = 4,
1424 /* int */ /* [1] */
1425 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1427 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), sizeof(void *)),
1431 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 4),
1432 /* PTR type_id=2 */ /* [4] */
1442 .key_type_id = 1,
1444 .max_entries = 4,
1452 /* int */ /* [1] */
1453 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1455 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), sizeof(void *)),
1457 BTF_MEMBER_ENC(NAME_TBD, 4, 0),
1459 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), sizeof(void *)),
1462 /* CONST type_id=5 */ /* [4] */
1468 /* PTR type_id=4 */ /* [7] */
1469 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 4),
1478 .key_type_id = 1,
1480 .max_entries = 4,
1488 /* int */ /* [1] */
1489 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
1493 .str_sec_size = sizeof("\0int") - 1,
1498 .key_type_id = 1,
1499 .value_type_id = 1,
1500 .max_entries = 4,
1508 /* int */ /* [1] */
1509 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1518 .key_type_id = 1,
1519 .value_type_id = 1,
1520 .max_entries = 4,
1536 .key_type_id = 1,
1537 .value_type_id = 1,
1538 .max_entries = 4,
1546 /* int */ /* [1] */
1547 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
1556 .key_type_id = 1,
1557 .value_type_id = 1,
1558 .max_entries = 4,
1560 .hdr_len_delta = 4,
1567 /* int */ /* [1] */
1568 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
1577 .key_type_id = 1,
1578 .value_type_id = 1,
1579 .max_entries = 4,
1581 .type_off_delta = 4,
1588 /* int */ /* [1] */
1589 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
1598 .key_type_id = 1,
1599 .value_type_id = 1,
1600 .max_entries = 4,
1602 .str_off_delta = 4,
1609 /* int */ /* [1] */
1610 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
1619 .key_type_id = 1,
1620 .value_type_id = 1,
1621 .max_entries = 4,
1623 .str_off_delta = -4,
1630 /* int */ /* [1] */
1631 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
1640 .key_type_id = 1,
1641 .value_type_id = 1,
1642 .max_entries = 4,
1644 .str_len_delta = -4,
1651 /* int */ /* [1] */
1652 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
1661 .key_type_id = 1,
1662 .value_type_id = 1,
1663 .max_entries = 4,
1665 .str_len_delta = 4,
1672 /* int */ /* [1] */
1673 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1675 BTF_TYPE_ARRAY_ENC(1, 1, 16),
1684 .key_type_id = 1,
1685 .value_type_id = 1,
1686 .max_entries = 4,
1692 /* int */ /* [1] */
1693 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1696 /* CONST type_id=1 */ /* [3] */
1697 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 1),
1706 .key_type_id = 1,
1707 .value_type_id = 1,
1708 .max_entries = 4,
1714 /* int */ /* [1] */
1715 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1717 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 31, 4),
1719 BTF_TYPE_ARRAY_ENC(1, 4, 16),
1720 /* CONST type_id=2 */ /* [4] */
1730 .key_type_id = 1,
1731 .value_type_id = 1,
1732 .max_entries = 4,
1740 /* int */ /* [1] */
1741 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1743 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 31, 4),
1745 BTF_TYPE_ARRAY_ENC(4, 1, 16),
1746 /* CONST type_id=2 */ /* [4] */
1756 .key_type_id = 1,
1757 .value_type_id = 1,
1758 .max_entries = 4,
1766 /* int */ /* [1] */
1767 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1769 BTF_TYPE_ARRAY_ENC(1, 0, 16),
1778 .key_type_id = 1,
1779 .value_type_id = 1,
1780 .max_entries = 4,
1788 /* int */ /* [1] */
1789 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1791 BTF_TYPE_ARRAY_ENC(1, 3, 16),
1802 .key_type_id = 1,
1803 .value_type_id = 1,
1804 .max_entries = 4,
1812 /* int */ /* [1] */
1813 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1815 BTF_TYPE_ARRAY_ENC(3, 1, 16),
1826 .key_type_id = 1,
1827 .value_type_id = 1,
1828 .max_entries = 4,
1836 /* int */ /* [1] */
1837 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1839 BTF_TYPE_ARRAY_ENC(3, 1, 16),
1840 /* CONST type_id=4 */ /* [3] */
1841 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 4),
1842 /* void* */ /* [4] */
1852 .key_type_id = 1,
1853 .value_type_id = 1,
1854 .max_entries = 4,
1860 /* int */ /* [1] */
1861 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1864 /* CONST type_id=4 */ /* [3] */
1865 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 4),
1866 /* void* */ /* [4] */
1876 .key_type_id = 1,
1877 .value_type_id = 1,
1878 .max_entries = 4,
1884 .descr = "array test. t->size != 0\"",
1886 /* int */ /* [1] */
1887 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1889 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ARRAY, 0, 0), 1),
1890 BTF_ARRAY_ENC(1, 1, 16),
1899 .key_type_id = 1,
1900 .value_type_id = 1,
1901 .max_entries = 4,
1909 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_INT, 0, 0), 4),
1919 .key_type_id = 1,
1920 .value_type_id = 1,
1921 .max_entries = 4,
1929 /* int */ /* [1] */
1930 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1931 BTF_TYPE_ENC(0, 0x20000000, 4),
1940 .key_type_id = 1,
1941 .value_type_id = 1,
1942 .max_entries = 4,
1948 .descr = "fwd test. t->type != 0\"",
1950 /* int */ /* [1] */
1951 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
1953 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_FWD, 0, 0), 1),
1962 .key_type_id = 1,
1963 .value_type_id = 1,
1964 .max_entries = 4,
1972 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
1973 BTF_TYPEDEF_ENC(0, 1), /* [2] */
1982 .key_type_id = 1,
1983 .value_type_id = 1,
1984 .max_entries = 4,
1992 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
1993 BTF_TYPEDEF_ENC(NAME_TBD, 1), /* [2] */
2002 .key_type_id = 1,
2003 .value_type_id = 1,
2004 .max_entries = 4,
2012 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2014 BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 1), /* [2] */
2023 .key_type_id = 1,
2024 .value_type_id = 1,
2025 .max_entries = 4,
2033 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2035 BTF_INFO_ENC(BTF_KIND_VOLATILE, 0, 0), 1), /* [2] */
2044 .key_type_id = 1,
2045 .value_type_id = 1,
2046 .max_entries = 4,
2054 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2056 BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 1), /* [2] */
2065 .key_type_id = 1,
2066 .value_type_id = 1,
2067 .max_entries = 4,
2075 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2076 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 1), /* [2] */
2087 .key_type_id = 1,
2088 .value_type_id = 1,
2089 .max_entries = 4,
2097 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2107 .key_type_id = 1,
2108 .value_type_id = 1,
2109 .max_entries = 4,
2117 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2128 .key_type_id = 1,
2129 .value_type_id = 1,
2130 .max_entries = 4,
2138 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2141 BTF_ARRAY_ENC(1, 1, 4),
2150 .key_type_id = 1,
2151 .value_type_id = 1,
2152 .max_entries = 4,
2160 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2162 BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), 4), /* [2] */
2163 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
2172 .key_type_id = 1,
2173 .value_type_id = 1,
2174 .max_entries = 4,
2180 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2182 BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), 4), /* [2] */
2183 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
2192 .key_type_id = 1,
2193 .value_type_id = 1,
2194 .max_entries = 4,
2202 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2204 BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), 4), /* [2] */
2205 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
2214 .key_type_id = 1,
2215 .value_type_id = 1,
2216 .max_entries = 4,
2222 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2224 BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), 4), /* [2] */
2225 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
2234 .key_type_id = 1,
2235 .value_type_id = 1,
2236 .max_entries = 4,
2244 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2246 BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1),
2257 .key_type_id = 1,
2258 .value_type_id = 1,
2259 .max_entries = 4,
2265 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2267 BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1),
2278 .key_type_id = 1,
2279 .value_type_id = 1,
2280 .max_entries = 4,
2288 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2290 BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1),
2301 .key_type_id = 1,
2302 .value_type_id = 1,
2303 .max_entries = 4,
2311 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2313 BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1),
2324 .key_type_id = 1,
2325 .value_type_id = 1,
2326 .max_entries = 4,
2333 /* int */ /* [1] */
2334 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
2346 .value_type_id = 1,
2347 .max_entries = 4,
2354 /* int */ /* [1] */
2355 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
2367 .value_type_id = 1,
2368 .max_entries = 4,
2375 /* int */ /* [1] */
2376 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
2384 /* btf_value_size < map->value_size */
2386 .key_type_id = 1,
2387 .value_type_id = 1,
2388 .max_entries = 4,
2395 /* int */ /* [1] */
2396 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
2404 /* btf_value_size > map->value_size */
2406 .key_type_id = 1,
2407 .value_type_id = 1,
2408 .max_entries = 4,
2415 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2416 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2418 BTF_FUNC_PROTO_ENC(1, 2), /* [3] */
2419 BTF_FUNC_PROTO_ARG_ENC(0, 1),
2429 .key_type_id = 1,
2430 .value_type_id = 1,
2431 .max_entries = 4,
2437 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2438 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2441 BTF_FUNC_PROTO_ARG_ENC(0, 1),
2452 .key_type_id = 1,
2453 .value_type_id = 1,
2454 .max_entries = 4,
2460 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2461 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2464 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
2475 .key_type_id = 1,
2476 .value_type_id = 1,
2477 .max_entries = 4,
2485 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2486 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2489 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
2500 .key_type_id = 1,
2501 .value_type_id = 1,
2502 .max_entries = 4,
2510 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2511 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2515 BTF_CONST_ENC(3), /* [4] */
2518 BTF_FUNC_PROTO_ARG_ENC(0, 1),
2528 .key_type_id = 1,
2529 .value_type_id = 1,
2530 .max_entries = 4,
2536 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2537 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2538 BTF_TYPEDEF_ENC(NAME_TBD, 4), /* [3] */
2539 BTF_FUNC_PROTO_ENC(0, 2), /* [4] */
2540 BTF_FUNC_PROTO_ARG_ENC(0, 1),
2550 .key_type_id = 1,
2551 .value_type_id = 1,
2552 .max_entries = 4,
2558 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2560 BTF_FUNC_PROTO_ENC(0, 1), /* [2] */
2562 BTF_CONST_ENC(4), /* [3] */
2563 BTF_PTR_ENC(0), /* [4] */
2572 .key_type_id = 1,
2573 .value_type_id = 1,
2574 .max_entries = 4,
2580 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2581 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2584 BTF_FUNC_PROTO_ARG_ENC(0, 1),
2594 .key_type_id = 1,
2595 .value_type_id = 1,
2596 .max_entries = 4,
2602 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2603 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2606 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
2616 .key_type_id = 1,
2617 .value_type_id = 1,
2618 .max_entries = 4,
2626 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2627 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2630 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
2640 .key_type_id = 1,
2641 .value_type_id = 1,
2642 .max_entries = 4,
2650 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2651 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2654 BTF_FUNC_PROTO_ARG_ENC(0, 1),
2664 .key_type_id = 1,
2665 .value_type_id = 1,
2666 .max_entries = 4,
2674 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2675 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2678 BTF_FUNC_PROTO_ARG_ENC(0, 1),
2688 .key_type_id = 1,
2689 .value_type_id = 1,
2690 .max_entries = 4,
2698 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2699 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2701 BTF_FUNC_PROTO_ENC(0, 1), /* [3] */
2702 BTF_FUNC_PROTO_ARG_ENC(0, 4),
2703 BTF_CONST_ENC(0), /* [4] */
2712 .key_type_id = 1,
2713 .value_type_id = 1,
2714 .max_entries = 4,
2716 .err_str = "Invalid arg#1",
2722 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2723 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2726 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
2729 BTF_FUNC_ENC(NAME_TBD, 3), /* [4] */
2738 .key_type_id = 1,
2739 .value_type_id = 1,
2740 .max_entries = 4,
2746 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2747 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2750 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
2753 BTF_FUNC_ENC(0, 3), /* [4] */
2762 .key_type_id = 1,
2763 .value_type_id = 1,
2764 .max_entries = 4,
2772 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2773 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2776 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
2779 BTF_FUNC_ENC(NAME_TBD, 3), /* [4] */
2788 .key_type_id = 1,
2789 .value_type_id = 1,
2790 .max_entries = 4,
2798 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2799 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2802 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
2805 BTF_FUNC_ENC(NAME_TBD, 3), /* [4] */
2814 .key_type_id = 1,
2815 .value_type_id = 1,
2816 .max_entries = 4,
2824 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2825 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [2] */
2828 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
2831 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_FUNC, 0, 2), 3), /* [4] */
2840 .key_type_id = 1,
2841 .value_type_id = 1,
2842 .max_entries = 4,
2850 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2851 BTF_FUNC_ENC(NAME_TBD, 1), /* [2] */
2860 .key_type_id = 1,
2861 .value_type_id = 1,
2862 .max_entries = 4,
2870 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2871 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_INT, 1, 0), 4), /* [2] */
2880 .key_type_id = 1,
2881 .value_type_id = 1,
2882 .max_entries = 4,
2890 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2891 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 1, 0), 1), /* [2] */
2899 .key_type_id = 1,
2900 .value_type_id = 1,
2901 .max_entries = 4,
2909 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2910 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ARRAY, 1, 0), 0), /* [2] */
2911 BTF_ARRAY_ENC(1, 1, 1),
2919 .key_type_id = 1,
2920 .value_type_id = 1,
2921 .max_entries = 4,
2929 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2931 BTF_INFO_ENC(BTF_KIND_FWD, 1, 0), 0), /* [2] */
2939 .key_type_id = 1,
2940 .value_type_id = 1,
2941 .max_entries = 4,
2947 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2949 BTF_INFO_ENC(BTF_KIND_TYPEDEF, 1, 0), 1), /* [2] */
2957 .key_type_id = 1,
2958 .value_type_id = 1,
2959 .max_entries = 4,
2967 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2968 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_VOLATILE, 1, 0), 1), /* [2] */
2976 .key_type_id = 1,
2977 .value_type_id = 1,
2978 .max_entries = 4,
2986 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
2987 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 1, 0), 1), /* [2] */
2995 .key_type_id = 1,
2996 .value_type_id = 1,
2997 .max_entries = 4,
3005 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3006 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_RESTRICT, 1, 0), 1), /* [2] */
3014 .key_type_id = 1,
3015 .value_type_id = 1,
3016 .max_entries = 4,
3024 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3026 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_FUNC, 1, 0), 2), /* [3] */
3034 .key_type_id = 1,
3035 .value_type_id = 1,
3036 .max_entries = 4,
3044 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3045 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_FUNC_PROTO, 1, 0), 0), /* [2] */
3053 .key_type_id = 1,
3054 .value_type_id = 1,
3055 .max_entries = 4,
3063 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3064 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 2), 8), /* [2] */
3065 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(0, 0)),
3066 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(0, 32)),
3074 .key_type_id = 1,
3075 .value_type_id = 1,
3076 .max_entries = 4,
3082 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3083 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 2), 4), /* [2] */
3084 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(4, 0)),
3085 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(4, 4)),
3093 .key_type_id = 1,
3094 .value_type_id = 1,
3095 .max_entries = 4,
3101 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3102 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_UNION, 1, 2), 4), /* [2] */
3103 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(4, 0)),
3104 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(4, 0)),
3112 .key_type_id = 1,
3113 .value_type_id = 1,
3114 .max_entries = 4,
3120 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3121 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4), /* [2] */
3123 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 2), 4),/* [3] */
3124 BTF_MEMBER_ENC(NAME_TBD, 2, BTF_MEMBER_OFFSET(4, 0)),
3125 BTF_MEMBER_ENC(NAME_TBD, 2, BTF_MEMBER_OFFSET(4, 4)),
3133 .key_type_id = 1,
3134 .value_type_id = 1,
3135 .max_entries = 4,
3141 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3142 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4), /* [2] */
3144 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_UNION, 1, 2), 4), /* [3] */
3145 BTF_MEMBER_ENC(NAME_TBD, 2, BTF_MEMBER_OFFSET(4, 0)),
3146 BTF_MEMBER_ENC(NAME_TBD, 2, BTF_MEMBER_OFFSET(4, 0)),
3154 .key_type_id = 1,
3155 .value_type_id = 1,
3156 .max_entries = 4,
3162 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3163 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4), /* [2] */
3165 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 2), 4),/* [3] */
3166 BTF_MEMBER_ENC(NAME_TBD, 4, BTF_MEMBER_OFFSET(4, 0)),
3167 BTF_MEMBER_ENC(NAME_TBD, 5, BTF_MEMBER_OFFSET(4, 4)),
3168 BTF_TYPEDEF_ENC(NAME_TBD, 1), /* [4] */
3177 .key_type_id = 1,
3178 .value_type_id = 1,
3179 .max_entries = 4,
3185 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3186 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4), /* [2] */
3188 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_UNION, 1, 2), 4), /* [3] */
3189 BTF_MEMBER_ENC(NAME_TBD, 4, BTF_MEMBER_OFFSET(4, 0)),
3190 BTF_MEMBER_ENC(NAME_TBD, 5, BTF_MEMBER_OFFSET(4, 0)),
3191 BTF_TYPEDEF_ENC(NAME_TBD, 1), /* [4] */
3200 .key_type_id = 1,
3201 .value_type_id = 1,
3202 .max_entries = 4,
3208 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3209 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 2), 4), /* [2] */
3210 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(20, 0)),
3211 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(20, 20)),
3219 .key_type_id = 1,
3220 .value_type_id = 1,
3221 .max_entries = 4,
3229 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3230 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 20, 4), /* [2] */
3231 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 2), 4), /* [3] */
3241 .key_type_id = 1,
3242 .value_type_id = 1,
3243 .max_entries = 4,
3251 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3252 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 12, 4), /* [2] */
3253 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 2), 4), /* [3] */
3263 .key_type_id = 1,
3264 .value_type_id = 1,
3265 .max_entries = 4,
3273 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3274 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_UNION, 1, 2), 2), /* [2] */
3275 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(8, 0)),
3276 BTF_MEMBER_ENC(NAME_TBD, 1, BTF_MEMBER_OFFSET(20, 0)),
3284 .key_type_id = 1,
3285 .value_type_id = 1,
3286 .max_entries = 4,
3294 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3295 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
3296 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 2), 12), /* [3] */
3306 .key_type_id = 1,
3307 .value_type_id = 1,
3308 .max_entries = 4,
3316 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3317 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
3318 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4), /* [2] */
3320 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 2), 12), /* [3] */
3330 .key_type_id = 1,
3331 .value_type_id = 1,
3332 .max_entries = 4,
3338 .descr = "128-bit int",
3340 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3349 .key_type_id = 1,
3350 .value_type_id = 1,
3351 .max_entries = 4,
3355 .descr = "struct, 128-bit int member",
3357 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3359 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), 16), /* [3] */
3368 .key_type_id = 1,
3369 .value_type_id = 1,
3370 .max_entries = 4,
3374 .descr = "struct, 120-bit int member bitfield",
3376 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3378 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), 16), /* [3] */
3387 .key_type_id = 1,
3388 .value_type_id = 1,
3389 .max_entries = 4,
3393 .descr = "struct, kind_flag, 128-bit int member",
3395 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3397 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 1), 16), /* [3] */
3406 .key_type_id = 1,
3407 .value_type_id = 1,
3408 .max_entries = 4,
3412 .descr = "struct, kind_flag, 120-bit int member bitfield",
3414 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3416 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 1), 16), /* [3] */
3425 .key_type_id = 1,
3426 .value_type_id = 1,
3427 .max_entries = 4,
3436 .descr = "struct->ptr->typedef->array->int size resolution",
3438 BTF_STRUCT_ENC(NAME_TBD, 1, 8), /* [1] */
3441 BTF_TYPEDEF_ENC(NAME_TBD, 4), /* [3] */
3442 BTF_TYPE_ARRAY_ENC(5, 5, 16), /* [4] */
3443 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [5] */
3453 .max_entries = 4,
3456 * typedef int arr_t[16][8][4];
3462 .descr = "struct->ptr->typedef->multi-array->int size resolution",
3464 BTF_STRUCT_ENC(NAME_TBD, 1, 8), /* [1] */
3467 BTF_TYPEDEF_ENC(NAME_TBD, 4), /* [3] */
3468 BTF_TYPE_ARRAY_ENC(5, 7, 16), /* [4] */
3470 BTF_TYPE_ARRAY_ENC(7, 7, 4), /* [6] */
3471 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [7] */
3478 .value_size = sizeof(int) * 16 * 8 * 4,
3481 .max_entries = 4,
3485 * typedef int_t arr3_t[4];
3493 .descr = "typedef/multi-arr mix size resolution",
3495 BTF_STRUCT_ENC(NAME_TBD, 1, 8), /* [1] */
3498 BTF_TYPEDEF_ENC(NAME_TBD, 4), /* [3] */
3499 BTF_TYPE_ARRAY_ENC(5, 10, 16), /* [4] */
3503 BTF_TYPE_ARRAY_ENC(9, 10, 4), /* [8] */
3505 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [10] */
3512 .value_size = sizeof(int) * 16 * 8 * 4,
3515 .max_entries = 4,
3518 * elf .rodata section size 4 and btf .rodata section vlen 0.
3524 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3526 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 0), 4),
3534 .key_type_id = 1,
3535 .value_type_id = 1,
3536 .max_entries = 1,
3542 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3544 BTF_TYPE_ENC(1, BTF_INFO_ENC(BTF_KIND_VAR, 0, 0), 1),
3547 BTF_TYPE_ENC(3, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
3548 BTF_VAR_SECINFO_ENC(2, 0, 4),
3554 .descr = "datasec: name with non-printable first char not is ok",
3557 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3559 BTF_TYPE_ENC(1, BTF_INFO_ENC(BTF_KIND_VAR, 0, 0), 1),
3562 BTF_TYPE_ENC(3, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
3563 BTF_VAR_SECINFO_ENC(2, 0, 4),
3574 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3576 BTF_TYPE_ENC(1, BTF_INFO_ENC(BTF_KIND_VAR, 0, 0), 1),
3579 BTF_TYPE_ENC(3, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
3580 BTF_VAR_SECINFO_ENC(2, 0, 4),
3591 BTF_TYPE_ENC(1, BTF_INFO_ENC(BTF_KIND_FWD, 1, 0), 0), /* [1] */
3600 .descr = "float test #1, well-formed",
3602 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
3603 /* [1] */
3605 BTF_TYPE_FLOAT_ENC(NAME_TBD, 4), /* [3] */
3606 BTF_TYPE_FLOAT_ENC(NAME_TBD, 8), /* [4] */
3612 BTF_MEMBER_ENC(NAME_TBD, 4, 64),
3623 .key_type_id = 1,
3625 .max_entries = 1,
3630 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
3631 /* [1] */
3632 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_FLOAT, 0, 1), 4),
3640 .value_size = 4,
3641 .key_type_id = 1,
3643 .max_entries = 1,
3650 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
3651 /* [1] */
3652 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_FLOAT, 1, 0), 4),
3660 .value_size = 4,
3661 .key_type_id = 1,
3663 .max_entries = 1,
3668 .descr = "float test #4, member does not fit",
3670 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
3671 /* [1] */
3672 BTF_TYPE_FLOAT_ENC(NAME_TBD, 4), /* [2] */
3673 BTF_STRUCT_ENC(NAME_TBD, 1, 2), /* [3] */
3681 .value_size = 4,
3682 .key_type_id = 1,
3684 .max_entries = 1,
3691 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
3692 /* [1] */
3693 BTF_TYPE_FLOAT_ENC(NAME_TBD, 4), /* [2] */
3694 BTF_STRUCT_ENC(NAME_TBD, 1, 8), /* [3] */
3702 .value_size = 4,
3703 .key_type_id = 1,
3705 .max_entries = 1,
3712 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
3713 /* [1] */
3722 .key_type_id = 1,
3724 .max_entries = 1,
3730 .descr = "decl_tag test #1, struct/member, well-formed",
3732 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3734 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
3735 BTF_MEMBER_ENC(NAME_TBD, 1, 32),
3736 BTF_DECL_TAG_ENC(NAME_TBD, 2, -1),
3738 BTF_DECL_TAG_ENC(NAME_TBD, 2, 1),
3746 .key_type_id = 1,
3748 .max_entries = 1,
3751 .descr = "decl_tag test #2, union/member, well-formed",
3753 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3754 BTF_UNION_ENC(NAME_TBD, 2, 4), /* [2] */
3755 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
3756 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
3757 BTF_DECL_TAG_ENC(NAME_TBD, 2, -1),
3759 BTF_DECL_TAG_ENC(NAME_TBD, 2, 1),
3766 .value_size = 4,
3767 .key_type_id = 1,
3769 .max_entries = 1,
3772 .descr = "decl_tag test #3, variable, well-formed",
3774 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3775 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
3776 BTF_VAR_ENC(NAME_TBD, 1, 1), /* [3] */
3777 BTF_DECL_TAG_ENC(NAME_TBD, 2, -1),
3778 BTF_DECL_TAG_ENC(NAME_TBD, 3, -1),
3785 .value_size = 4,
3786 .key_type_id = 1,
3787 .value_type_id = 1,
3788 .max_entries = 1,
3791 .descr = "decl_tag test #4, func/parameter, well-formed",
3793 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3795 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
3796 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
3798 BTF_DECL_TAG_ENC(NAME_TBD, 3, -1),
3800 BTF_DECL_TAG_ENC(NAME_TBD, 3, 1),
3807 .value_size = 4,
3808 .key_type_id = 1,
3809 .value_type_id = 1,
3810 .max_entries = 1,
3815 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3816 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
3817 BTF_DECL_TAG_ENC(0, 2, -1),
3824 .value_size = 4,
3825 .key_type_id = 1,
3826 .value_type_id = 1,
3827 .max_entries = 1,
3834 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3835 BTF_DECL_TAG_ENC(NAME_TBD, 1, -1),
3842 .value_size = 4,
3843 .key_type_id = 1,
3844 .value_type_id = 1,
3845 .max_entries = 1,
3852 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3853 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
3854 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DECL_TAG, 0, 1), 2), (0),
3861 .value_size = 4,
3862 .key_type_id = 1,
3863 .value_type_id = 1,
3864 .max_entries = 1,
3871 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3872 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
3873 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DECL_TAG, 1, 0), 2), (-1),
3880 .value_size = 4,
3881 .key_type_id = 1,
3882 .value_type_id = 1,
3883 .max_entries = 1,
3890 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3891 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
3899 .value_size = 4,
3900 .key_type_id = 1,
3901 .value_type_id = 1,
3902 .max_entries = 1,
3909 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3911 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
3912 BTF_MEMBER_ENC(NAME_TBD, 1, 32),
3921 .key_type_id = 1,
3923 .max_entries = 1,
3930 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3932 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
3933 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
3942 .value_size = 4,
3943 .key_type_id = 1,
3944 .value_type_id = 1,
3945 .max_entries = 1,
3950 .descr = "decl_tag test #12, < -1 component_idx",
3952 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3954 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
3955 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
3957 BTF_DECL_TAG_ENC(NAME_TBD, 3, -2),
3964 .value_size = 4,
3965 .key_type_id = 1,
3966 .value_type_id = 1,
3967 .max_entries = 1,
3972 .descr = "decl_tag test #13, typedef, well-formed",
3974 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3975 BTF_TYPEDEF_ENC(NAME_TBD, 1), /* [2] */
3976 BTF_DECL_TAG_ENC(NAME_TBD, 2, -1),
3983 .value_size = 4,
3984 .key_type_id = 1,
3985 .value_type_id = 1,
3986 .max_entries = 1,
3991 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
3992 BTF_TYPEDEF_ENC(NAME_TBD, 1), /* [2] */
4000 .value_size = 4,
4001 .key_type_id = 1,
4002 .value_type_id = 1,
4003 .max_entries = 1,
4010 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4019 .value_size = 4,
4020 .key_type_id = 1,
4021 .value_type_id = 1,
4022 .max_entries = 1,
4029 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4030 BTF_VAR_ENC(NAME_TBD, 1, 0), /* [2] */
4031 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DECL_TAG, 0, 0), 2), (-1), /* [3] */
4032 BTF_FUNC_PROTO_ENC(3, 0), /* [4] */
4042 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DECL_TAG, 0, 0), 4), (-1), /* [1] */
4044 BTF_FUNC_PROTO_ENC(0, 1), /* [3] */
4045 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
4046 BTF_VAR_ENC(NAME_TBD, 2, 0), /* [4] */
4051 .err_str = "Invalid arg#1",
4056 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4058 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
4059 BTF_MEMBER_ENC(NAME_TBD, 1, 32),
4060 BTF_DECL_TAG_ENC(NAME_TBD, 2, -1), /* [3] */
4067 .value_size = 4,
4069 .value_type_id = 1,
4070 .max_entries = 1,
4076 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4078 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
4079 BTF_MEMBER_ENC(NAME_TBD, 1, 32),
4080 BTF_DECL_TAG_ENC(NAME_TBD, 2, -1), /* [3] */
4086 .key_size = 4,
4088 .key_type_id = 1,
4090 .max_entries = 1,
4094 .descr = "type_tag test #1",
4096 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4097 BTF_TYPE_TAG_ENC(NAME_TBD, 1), /* [2] */
4105 .value_size = 4,
4106 .key_type_id = 1,
4107 .value_type_id = 1,
4108 .max_entries = 1,
4113 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4115 BTF_TYPE_TAG_ENC(NAME_TBD, 1), /* [3] */
4122 .value_size = 4,
4123 .key_type_id = 1,
4124 .value_type_id = 1,
4125 .max_entries = 1,
4132 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4134 BTF_CONST_ENC(4), /* [3] */
4135 BTF_TYPE_TAG_ENC(NAME_TBD, 1), /* [4] */
4142 .value_size = 4,
4143 .key_type_id = 1,
4144 .value_type_id = 1,
4145 .max_entries = 1,
4150 .descr = "type_tag test #4, type tag order",
4152 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4154 BTF_CONST_ENC(4), /* [3] */
4155 BTF_TYPE_TAG_ENC(NAME_TBD, 1), /* [4] */
4162 .value_size = 4,
4163 .key_type_id = 1,
4164 .value_type_id = 1,
4165 .max_entries = 1,
4172 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4174 BTF_CONST_ENC(1), /* [3] */
4175 BTF_TYPE_TAG_ENC(NAME_TBD, 2), /* [4] */
4182 .value_size = 4,
4183 .key_type_id = 1,
4184 .value_type_id = 1,
4185 .max_entries = 1,
4190 BTF_PTR_ENC(2), /* [1] */
4192 BTF_CONST_ENC(4), /* [3] */
4193 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [4] */
4202 .value_size = 4,
4203 .key_type_id = 1,
4204 .value_type_id = 1,
4205 .max_entries = 1,
4210 .descr = "enum64 test #1, unsigned, size 8",
4212 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4215 BTF_ENUM64_ENC(NAME_TBD, 1, 1),
4223 .key_type_id = 1,
4225 .max_entries = 1,
4228 .descr = "enum64 test #2, signed, size 4",
4230 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
4231 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_ENUM64, 1, 2), 4), /* [2] */
4232 BTF_ENUM64_ENC(NAME_TBD, -1, 0),
4233 BTF_ENUM64_ENC(NAME_TBD, 1, 0),
4240 .value_size = 4,
4241 .key_type_id = 1,
4243 .max_entries = 1,
4250 return start < end - 1 ? start + 1 : NULL; in get_next_str()
4257 for (i = MAX_NR_RAW_U32 - 1; in get_raw_sec_size()
4259 i--) in get_raw_sec_size()
4302 err = -1; in btf_raw_create()
4318 err = -1; in btf_raw_create()
4321 ret_types[i] = strs_idx[next_str_idx++] - str; in btf_raw_create()
4328 err = -1; in btf_raw_create()
4331 ret_types[i] = strs_idx[idx-1] - str; in btf_raw_create()
4342 ret_hdr->type_len = type_sec_size; in btf_raw_create()
4343 ret_hdr->str_off = type_sec_size; in btf_raw_create()
4344 ret_hdr->str_len = str_sec_size; in btf_raw_create()
4368 opts.log_level = 1; in load_raw_btf()
4375 opts.log_level = 1; in load_raw_btf()
4384 struct btf_raw_test *test = &raw_tests[test_num - 1]; in do_test_raw()
4386 int map_fd = -1, btf_fd = -1; in do_test_raw()
4392 if (!test__start_subtest(test->descr)) in do_test_raw()
4396 test->raw_types, in do_test_raw()
4397 test->str_sec, in do_test_raw()
4398 test->str_sec_size, in do_test_raw()
4405 hdr->hdr_len = (int)hdr->hdr_len + test->hdr_len_delta; in do_test_raw()
4406 hdr->type_off = (int)hdr->type_off + test->type_off_delta; in do_test_raw()
4407 hdr->str_off = (int)hdr->str_off + test->str_off_delta; in do_test_raw()
4408 hdr->str_len = (int)hdr->str_len + test->str_len_delta; in do_test_raw()
4414 err = ((btf_fd < 0) != test->btf_load_err); in do_test_raw()
4415 if (CHECK(err, "btf_fd:%d test->btf_load_err:%u", in do_test_raw()
4416 btf_fd, test->btf_load_err) || in do_test_raw()
4417 CHECK(test->err_str && !strstr(btf_log_buf, test->err_str), in do_test_raw()
4418 "expected err_str:%s\n", test->err_str)) { in do_test_raw()
4419 err = -1; in do_test_raw()
4426 if (!test->map_type) in do_test_raw()
4430 opts.btf_key_type_id = test->key_type_id; in do_test_raw()
4431 opts.btf_value_type_id = test->value_type_id; in do_test_raw()
4432 map_fd = bpf_map_create(test->map_type, test->map_name, in do_test_raw()
4433 test->key_size, test->value_size, test->max_entries, &opts); in do_test_raw()
4435 err = ((map_fd < 0) != test->map_create_err); in do_test_raw()
4436 CHECK(err, "map_fd:%d test->map_create_err:%u", in do_test_raw()
4437 map_fd, test->map_create_err); in do_test_raw()
4462 .descr = "== raw_btf_size+1",
4464 /* int */ /* [1] */
4465 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
4470 .btf_size_delta = 1,
4473 .descr = "== raw_btf_size-3",
4475 /* int */ /* [1] */
4476 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
4481 .btf_size_delta = -3,
4486 /* int */ /* [1] */
4487 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
4497 /* int */ /* [1] */
4498 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
4500 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4),
4511 const struct btf_get_info_test *test = &get_info_tests[test_num - 1]; in test_big_btf_info()
4519 int btf_fd = -1, err; in test_big_btf_info()
4523 test->raw_types, in test_big_btf_info()
4524 test->str_sec, in test_big_btf_info()
4525 test->str_sec_size, in test_big_btf_info()
4529 return -1; in test_big_btf_info()
4535 err = -1; in test_big_btf_info()
4541 err = -1; in test_big_btf_info()
4553 info->btf = ptr_to_u64(user_btf); in test_big_btf_info()
4554 info->btf_size = raw_btf_size; in test_big_btf_info()
4558 err = -1; in test_big_btf_info()
4573 err = -1; in test_big_btf_info()
4594 const struct btf_get_info_test *test = &get_info_tests[test_num - 1]; in test_btf_id()
4597 int btf_fd[2] = {-1, -1}, map_fd = -1; in test_btf_id()
4605 test->raw_types, in test_btf_id()
4606 test->str_sec, in test_btf_id()
4607 test->str_sec_size, in test_btf_id()
4611 return -1; in test_btf_id()
4618 err = -1; in test_btf_id()
4627 err = -1; in test_btf_id()
4635 err = -1; in test_btf_id()
4639 btf_fd[1] = bpf_btf_get_fd_by_id(info[0].id); in test_btf_id()
4640 if (CHECK(btf_fd[1] < 0, "errno:%d", errno)) { in test_btf_id()
4641 err = -1; in test_btf_id()
4646 err = bpf_btf_get_info_by_fd(btf_fd[1], &info[1], &info_len); in test_btf_id()
4647 if (CHECK(err || info[0].id != info[1].id || in test_btf_id()
4648 info[0].btf_size != info[1].btf_size || in test_btf_id()
4649 (ret = memcmp(user_btf[0], user_btf[1], info[0].btf_size)), in test_btf_id()
4651 err, errno, info[0].id, info[1].id, in test_btf_id()
4652 info[0].btf_size, info[1].btf_size, ret)) { in test_btf_id()
4653 err = -1; in test_btf_id()
4659 opts.btf_key_type_id = 1; in test_btf_id()
4662 sizeof(int), sizeof(int), 4, &opts); in test_btf_id()
4664 err = -1; in test_btf_id()
4671 map_info.btf_key_type_id != 1 || map_info.btf_value_type_id != 2, in test_btf_id()
4675 err = -1; in test_btf_id()
4681 btf_fd[i] = -1; in test_btf_id()
4687 err = -1; in test_btf_id()
4691 btf_fd[0] = -1; in test_btf_id()
4695 map_fd = -1; in test_btf_id()
4717 const struct btf_get_info_test *test = &get_info_tests[test_num - 1]; in do_test_get_info()
4721 int btf_fd = -1, err, ret; in do_test_get_info()
4724 if (!test__start_subtest(test->descr)) in do_test_get_info()
4727 if (test->special_test) { in do_test_get_info()
4728 err = test->special_test(test_num); in do_test_get_info()
4734 test->raw_types, in do_test_get_info()
4735 test->str_sec, in do_test_get_info()
4736 test->str_sec_size, in do_test_get_info()
4746 err = -1; in do_test_get_info()
4752 err = -1; in do_test_get_info()
4756 user_btf_size = (int)raw_btf_size + test->btf_size_delta; in do_test_get_info()
4760 raw_btf_size - expected_nbytes); in do_test_get_info()
4774 err = -1; in do_test_get_info()
4781 "user_btf[%u]:%x != 0xff", expected_nbytes - 1, in do_test_get_info()
4782 user_btf[expected_nbytes - 1])) { in do_test_get_info()
4783 err = -1; in do_test_get_info()
4813 const struct btf_file_test *test = &file_tests[test_num - 1]; in do_test_file()
4829 if (!test__start_subtest(test->file)) in do_test_file()
4832 btf = btf__parse_elf(test->file, &btf_ext); in do_test_file()
4835 if (err == -ENOENT) { in do_test_file()
4849 obj = bpf_object__open(test->file); in do_test_file()
4856 err = -1; in do_test_file()
4868 err = -1; in do_test_file()
4873 != test->btf_kv_notfound; in do_test_file()
4874 if (CHECK(err, "btf_key_type_id:%u btf_value_type_id:%u test->btf_kv_notfound:%u", in do_test_file()
4876 test->btf_kv_notfound)) in do_test_file()
4886 if (CHECK(err < 0, "invalid get info (1st) errno:%d", errno)) { in do_test_file()
4888 err = -1; in do_test_file()
4892 "incorrect info.nr_func_info (1st) %d", in do_test_file()
4894 err = -1; in do_test_file()
4899 "incorrect info.func_info_rec_size (1st) %d\n", rec_size)) { in do_test_file()
4900 err = -1; in do_test_file()
4906 err = -1; in do_test_file()
4920 err = -1; in do_test_file()
4926 err = -1; in do_test_file()
4932 err = -1; in do_test_file()
4947 t = btf__type_by_id(btf, finfo->type_id); in do_test_file()
4949 finfo->type_id)) { in do_test_file()
4950 err = -1; in do_test_file()
4954 fname = btf__name_by_offset(btf, t->name_off); in do_test_file()
4960 err = strcmp(fname, expected_fnames[3 - i]); in do_test_file()
4962 err = -1; in do_test_file()
5023 /* unsigned char */ /* [1] */
5024 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 8, 1),
5028 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 32, 4),
5029 /* int */ /* [4] */
5030 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
5036 BTF_TYPE_INT_ENC(0, 0, 0, 28, 4),
5038 BTF_TYPE_ARRAY_ENC(9, 1, 8),
5040 BTF_TYPEDEF_ENC(NAME_TBD, 1),
5046 BTF_TYPEDEF_ENC(NAME_TBD, 4),
5054 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 4), 4),
5056 BTF_ENUM_ENC(NAME_TBD, 1),
5072 BTF_TYPE_ARRAY_ENC(18, 1, 2), /* [17] */
5073 BTF_TYPE_ARRAY_ENC(1, 1, 2), /* [18] */
5090 /* unsigned char */ /* [1] */
5091 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 8, 1),
5095 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 32, 4),
5096 /* int */ /* [4] */
5097 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
5100 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [6] */
5101 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [7] */
5103 BTF_TYPE_ARRAY_ENC(9, 1, 8),
5105 BTF_TYPEDEF_ENC(NAME_TBD, 1),
5111 BTF_TYPEDEF_ENC(NAME_TBD, 4),
5119 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 4), 4),
5121 BTF_ENUM_ENC(NAME_TBD, 1),
5125 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 11), 40),
5137 BTF_TYPE_ARRAY_ENC(18, 1, 2), /* [17] */
5138 BTF_TYPE_ARRAY_ENC(1, 1, 2), /* [18] */
5157 /* unsigned char */ /* [1] */
5158 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 8, 1),
5162 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 32, 4),
5163 /* int */ /* [4] */
5164 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4),
5167 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [6] */
5168 BTF_TYPE_INT_ENC(0, 0, 0, 32, 4), /* [7] */
5170 BTF_TYPE_ARRAY_ENC(9, 1, 8),
5172 BTF_TYPEDEF_ENC(NAME_TBD, 1),
5178 BTF_TYPEDEF_ENC(NAME_TBD, 4),
5186 BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 4), 4),
5188 BTF_ENUM_ENC(NAME_TBD, 1),
5192 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 11), 40),
5208 BTF_TYPE_ARRAY_ENC(21, 1, 2), /* [20] */
5209 BTF_TYPE_ARRAY_ENC(1, 1, 2), /* [21] */
5224 /* unsigned int */ /* [1] */
5225 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 32, 4),
5230 /* struct pprint_mapv_int128 */ /* [4] */
5231 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 5), 64),
5242 .key_type_id = 1,
5243 .value_type_id = 4,
5339 v->ui32 = i + cpu; in set_pprint_mapv()
5340 v->si32 = -i; in set_pprint_mapv()
5341 v->unused_bits2a = 3; in set_pprint_mapv()
5342 v->bits28 = i; in set_pprint_mapv()
5343 v->unused_bits2b = 3; in set_pprint_mapv()
5344 v->ui64 = i; in set_pprint_mapv()
5345 v->aenum = i & 0x03; in set_pprint_mapv()
5346 v->ui32b = 4; in set_pprint_mapv()
5347 v->bits2c = 1; in set_pprint_mapv()
5348 v->si8_4[0][0] = (cpu + i) & 0xff; in set_pprint_mapv()
5349 v->si8_4[0][1] = (cpu + i + 1) & 0xff; in set_pprint_mapv()
5350 v->si8_4[1][0] = (cpu + i + 2) & 0xff; in set_pprint_mapv()
5351 v->si8_4[1][1] = (cpu + i + 3) & 0xff; in set_pprint_mapv()
5361 v->si128a = i; in set_pprint_mapv()
5362 v->si128b = -i; in set_pprint_mapv()
5363 v->bits3 = i & 0x07; in set_pprint_mapv()
5364 v->bits80 = (((unsigned __int128)1) << 64) + i; in set_pprint_mapv()
5365 v->ui128 = (((unsigned __int128)2) << 64) + i; in set_pprint_mapv()
5377 ssize_t nexpected_line = -1; in get_pprint_expected_line()
5388 v->ui32, v->si32, in get_pprint_expected_line()
5389 v->unused_bits2a, in get_pprint_expected_line()
5390 v->bits28, in get_pprint_expected_line()
5391 v->unused_bits2b, in get_pprint_expected_line()
5392 (__u64)v->ui64, in get_pprint_expected_line()
5393 v->ui8a[0], v->ui8a[1], in get_pprint_expected_line()
5394 v->ui8a[2], v->ui8a[3], in get_pprint_expected_line()
5395 v->ui8a[4], v->ui8a[5], in get_pprint_expected_line()
5396 v->ui8a[6], v->ui8a[7], in get_pprint_expected_line()
5397 pprint_enum_str[v->aenum], in get_pprint_expected_line()
5398 v->ui32b, in get_pprint_expected_line()
5399 v->bits2c, in get_pprint_expected_line()
5400 v->si8_4[0][0], v->si8_4[0][1], in get_pprint_expected_line()
5401 v->si8_4[1][0], v->si8_4[1][1]); in get_pprint_expected_line()
5413 (uint64_t)v->si128a, in get_pprint_expected_line()
5414 (uint64_t)v->si128b, in get_pprint_expected_line()
5415 (uint64_t)v->bits3, in get_pprint_expected_line()
5416 (uint64_t)(v->bits80 >> 64), in get_pprint_expected_line()
5417 (uint64_t)v->bits80, in get_pprint_expected_line()
5418 (uint64_t)(v->ui128 >> 64), in get_pprint_expected_line()
5419 (uint64_t)v->ui128); in get_pprint_expected_line()
5431 return -1; in check_line()
5437 return -1; in check_line()
5447 enum pprint_mapv_kind_t mapv_kind = test->mapv_kind; in do_test_pprint()
5452 int map_fd = -1, btf_fd = -1; in do_test_pprint()
5463 if (!test__start_subtest(test->descr)) in do_test_pprint()
5466 raw_btf = btf_raw_create(&hdr_tmpl, test->raw_types, in do_test_pprint()
5467 test->str_sec, test->str_sec_size, in do_test_pprint()
5478 err = -1; in do_test_pprint()
5483 opts.btf_key_type_id = test->key_type_id; in do_test_pprint()
5484 opts.btf_value_type_id = test->value_type_id; in do_test_pprint()
5485 map_fd = bpf_map_create(test->map_type, test->map_name, in do_test_pprint()
5486 test->key_size, test->value_size, test->max_entries, &opts); in do_test_pprint()
5488 err = -1; in do_test_pprint()
5493 "/sys/fs/bpf", test->map_name); in do_test_pprint()
5496 "/sys/fs/bpf", test->map_name)) { in do_test_pprint()
5497 err = -1; in do_test_pprint()
5505 percpu_map = test->percpu_map; in do_test_pprint()
5506 num_cpus = percpu_map ? bpf_num_possible_cpus() : 1; in do_test_pprint()
5510 err = -1; in do_test_pprint()
5514 for (key = 0; key < test->max_entries; key++) { in do_test_pprint()
5521 err = -1; in do_test_pprint()
5531 err = -1; in do_test_pprint()
5536 ordered_map = test->ordered_map; in do_test_pprint()
5537 lossless_map = test->lossless_map; in do_test_pprint()
5598 } while (++nr_read_elems < test->max_entries && nread > 0); in do_test_pprint()
5601 CHECK(nr_read_elems < test->max_entries, in do_test_pprint()
5602 "Unexpected EOF. nr_read_elems:%u test->max_entries:%u", in do_test_pprint()
5603 nr_read_elems, test->max_entries)) { in do_test_pprint()
5604 err = -1; in do_test_pprint()
5609 err = -1; in do_test_pprint()
5649 for (i = 1; i < ARRAY_SIZE(pprint_test_template); i++) { in test_pprint()
5686 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5687 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 32, 4), /* [2] */
5688 BTF_FUNC_PROTO_ENC(1, 2), /* [3] */
5689 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
5691 BTF_FUNC_PROTO_ENC(1, 2), /* [4] */
5693 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
5695 BTF_FUNC_ENC(NAME_TBD, 4), /* [6] */
5701 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 2),
5702 BPF_MOV64_IMM(BPF_REG_0, 1),
5717 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5718 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 32, 4), /* [2] */
5719 BTF_FUNC_PROTO_ENC(1, 2), /* [3] */
5720 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
5722 BTF_FUNC_PROTO_ENC(1, 2), /* [4] */
5724 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
5726 BTF_FUNC_ENC(NAME_TBD, 4), /* [6] */
5732 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 2),
5733 BPF_MOV64_IMM(BPF_REG_0, 1),
5740 .func_info_rec_size = 4,
5749 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5750 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 32, 4), /* [2] */
5751 BTF_FUNC_PROTO_ENC(1, 2), /* [3] */
5752 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
5754 BTF_FUNC_PROTO_ENC(1, 2), /* [4] */
5756 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
5758 BTF_FUNC_ENC(NAME_TBD, 4), /* [6] */
5764 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 2),
5765 BPF_MOV64_IMM(BPF_REG_0, 1),
5773 .func_info_cnt = 1,
5781 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5782 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 32, 4), /* [2] */
5783 BTF_FUNC_PROTO_ENC(1, 2), /* [3] */
5784 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
5786 BTF_FUNC_PROTO_ENC(1, 2), /* [4] */
5788 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
5790 BTF_FUNC_ENC(NAME_TBD, 4), /* [6] */
5796 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 2),
5797 BPF_MOV64_IMM(BPF_REG_0, 1),
5813 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5816 BTF_STR_SEC("\0int\0int a=1;\0int b=2;\0return a + b;\0return a + b;"),
5818 BPF_MOV64_IMM(BPF_REG_0, 1),
5826 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
5827 BPF_LINE_INFO_ENC(1, 0, NAME_TBD, 2, 9),
5829 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 4, 7),
5833 .nr_jited_ksyms = 1,
5837 .descr = "line_info (No subprog. insn_off >= prog->len)",
5839 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5842 BTF_STR_SEC("\0int\0int a=1;\0int b=2;\0return a + b;\0return a + b;"),
5844 BPF_MOV64_IMM(BPF_REG_0, 1),
5852 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
5853 BPF_LINE_INFO_ENC(1, 0, NAME_TBD, 2, 9),
5855 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 4, 7),
5856 BPF_LINE_INFO_ENC(4, 0, 0, 5, 6),
5860 .nr_jited_ksyms = 1,
5861 .err_str = "line_info[4].insn_off",
5868 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5873 BTF_STR_SEC("\0int\0unsigned long\0u64\0u64 a=1;\0return a;"),
5875 BPF_LD_IMM64(BPF_REG_0, 1),
5881 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
5882 BPF_LINE_INFO_ENC(1, 0, 0, 2, 9),
5887 .nr_jited_ksyms = 1,
5888 .err_str = "Invalid insn code at line_info[1]",
5895 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5898 BTF_STR_SEC("\0int\0int a=1;\0int b=2;\0return a + b;\0return a + b;"),
5900 BPF_MOV64_IMM(BPF_REG_0, 1),
5908 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10), 0,
5909 BPF_LINE_INFO_ENC(1, 0, NAME_TBD, 2, 9), 0,
5911 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 4, 7), 0,
5915 .nr_jited_ksyms = 1,
5921 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5924 BTF_STR_SEC("\0int\0int a=1;\0int b=2;\0return a + b;\0return a + b;"),
5926 BPF_MOV64_IMM(BPF_REG_0, 1),
5934 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10), 0,
5935 BPF_LINE_INFO_ENC(1, 0, NAME_TBD, 2, 9), 0,
5937 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 4, 7), 1,
5941 .nr_jited_ksyms = 1,
5949 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5952 BTF_STR_SEC("\0int\0int a=1+1;\0return func(a);\0b+=1;\0return b;"),
5954 BPF_MOV64_IMM(BPF_REG_2, 1),
5955 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1),
5957 BPF_CALL_REL(1),
5960 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
5966 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
5969 BPF_LINE_INFO_ENC(7, 0, NAME_TBD, 4, 7),
5979 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
5980 BTF_FUNC_PROTO_ENC(1, 1), /* [2] */
5981 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
5983 BTF_FUNC_ENC(NAME_TBD, 2), /* [4] */
5986 BTF_STR_SEC("\0int\0x\0sub\0main\0int a=1+1;\0return func(a);\0b+=1;\0return b;"),
5988 BPF_MOV64_IMM(BPF_REG_2, 1),
5989 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1),
5991 BPF_CALL_REL(1),
5994 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
6000 .func_info = { {0, 4}, {5, 3} },
6002 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6005 BPF_LINE_INFO_ENC(7, 0, NAME_TBD, 4, 7),
6013 .descr = "line_info (subprog. missing 1st func line info)",
6015 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6018 BTF_STR_SEC("\0int\0int a=1+1;\0return func(a);\0b+=1;\0return b;"),
6020 BPF_MOV64_IMM(BPF_REG_2, 1),
6021 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1),
6023 BPF_CALL_REL(1),
6026 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
6032 BPF_LINE_INFO_ENC(1, 0, NAME_TBD, 1, 10),
6035 BPF_LINE_INFO_ENC(7, 0, NAME_TBD, 4, 7),
6047 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6050 BTF_STR_SEC("\0int\0int a=1+1;\0return func(a);\0b+=1;\0return b;"),
6052 BPF_MOV64_IMM(BPF_REG_2, 1),
6053 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1),
6055 BPF_CALL_REL(1),
6058 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
6064 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6067 BPF_LINE_INFO_ENC(7, 0, NAME_TBD, 4, 7),
6072 .err_str = "missing bpf_line_info for func#1",
6079 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6082 BTF_STR_SEC("\0int\0int a=1+1;\0return func(a);\0b+=1;\0return b;"),
6084 BPF_MOV64_IMM(BPF_REG_2, 1),
6085 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1),
6087 BPF_CALL_REL(1),
6090 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
6096 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6099 BPF_LINE_INFO_ENC(7, 0, NAME_TBD, 4, 7),
6111 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6114 BTF_STR_SEC("\0int\0/* dead jmp */\0int a=1;\0int b=2;\0return a + b;\0return a + b;"),
6117 BPF_MOV64_IMM(BPF_REG_0, 1),
6125 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6126 BPF_LINE_INFO_ENC(1, 0, NAME_TBD, 2, 9),
6128 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 4, 7),
6129 BPF_LINE_INFO_ENC(4, 0, NAME_TBD, 5, 6),
6133 .nr_jited_ksyms = 1,
6134 .dead_code_cnt = 1,
6141 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6144 …BTF_STR_SEC("\0int\0int a=1;\0int b=2;\0return a + b;\0/* dead jmp */\0return a + b;\0/* dead exit…
6146 BPF_MOV64_IMM(BPF_REG_0, 1),
6149 BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 10, 1),
6156 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 12),
6157 BPF_LINE_INFO_ENC(1, 0, NAME_TBD, 2, 11),
6159 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 4, 9),
6160 BPF_LINE_INFO_ENC(4, 0, NAME_TBD, 5, 8),
6165 .nr_jited_ksyms = 1,
6173 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6174 BTF_FUNC_PROTO_ENC(1, 1), /* [2] */
6175 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
6177 BTF_FUNC_ENC(NAME_TBD, 2), /* [4] */
6180 BTF_STR_SEC("\0int\0x\0sub\0main\0int a=1+1;\0/* dead jmp */"
6183 "\0return func(a);\0b+=1;\0return b;"),
6185 BPF_MOV64_IMM(BPF_REG_2, 1),
6186 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1),
6189 BPF_MOV64_IMM(BPF_REG_2, 1),
6190 BPF_MOV64_IMM(BPF_REG_2, 1),
6191 BPF_MOV64_IMM(BPF_REG_2, 1),
6192 BPF_MOV64_IMM(BPF_REG_2, 1),
6193 BPF_MOV64_IMM(BPF_REG_2, 1),
6194 BPF_MOV64_IMM(BPF_REG_2, 1),
6195 BPF_MOV64_IMM(BPF_REG_2, 1),
6196 BPF_MOV64_IMM(BPF_REG_2, 1),
6197 BPF_CALL_REL(1),
6200 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
6206 .func_info = { {0, 4}, {14, 3} },
6208 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6209 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 1, 10),
6210 BPF_LINE_INFO_ENC(4, 0, NAME_TBD, 1, 10),
6211 BPF_LINE_INFO_ENC(5, 0, NAME_TBD, 1, 10),
6212 BPF_LINE_INFO_ENC(6, 0, NAME_TBD, 1, 10),
6213 BPF_LINE_INFO_ENC(7, 0, NAME_TBD, 1, 10),
6214 BPF_LINE_INFO_ENC(8, 0, NAME_TBD, 1, 10),
6215 BPF_LINE_INFO_ENC(9, 0, NAME_TBD, 1, 10),
6216 BPF_LINE_INFO_ENC(10, 0, NAME_TBD, 1, 10),
6220 BPF_LINE_INFO_ENC(16, 0, NAME_TBD, 4, 7),
6232 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6233 BTF_FUNC_PROTO_ENC(1, 1), /* [2] */
6234 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
6236 BTF_FUNC_ENC(NAME_TBD, 2), /* [4] */
6240 BTF_STR_SEC("\0int\0x\0dead\0main\0func\0int a=1+1;\0/* live call */"
6242 "\0/* dead */\0return bla + 1;\0return bla + 1;"
6243 "\0return bla + 1;\0return func(a);\0b+=1;\0return b;"),
6245 BPF_MOV64_IMM(BPF_REG_2, 1),
6246 BPF_JMP_IMM(BPF_JGE, BPF_REG_2, 0, 1),
6252 BPF_CALL_REL(1),
6255 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
6261 .func_info = { {0, 4}, {6, 3}, {9, 5} },
6263 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6264 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 1, 10),
6265 BPF_LINE_INFO_ENC(4, 0, NAME_TBD, 1, 10),
6266 BPF_LINE_INFO_ENC(5, 0, NAME_TBD, 1, 10),
6267 BPF_LINE_INFO_ENC(6, 0, NAME_TBD, 1, 10),
6268 BPF_LINE_INFO_ENC(7, 0, NAME_TBD, 1, 10),
6269 BPF_LINE_INFO_ENC(8, 0, NAME_TBD, 1, 10),
6270 BPF_LINE_INFO_ENC(9, 0, NAME_TBD, 1, 10),
6271 BPF_LINE_INFO_ENC(10, 0, NAME_TBD, 1, 10),
6279 .dead_func_cnt = 1,
6286 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6287 BTF_FUNC_PROTO_ENC(1, 1), /* [2] */
6288 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
6293 BTF_STR_SEC("\0int\0x\0dead\0main\0int a=1+1;\0/* live call */"
6296 BPF_MOV64_IMM(BPF_REG_2, 1),
6297 BPF_JMP_IMM(BPF_JGE, BPF_REG_2, 0, 1),
6307 .func_info = { {0, 4}, {5, 3} },
6309 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6310 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 1, 10),
6311 BPF_LINE_INFO_ENC(4, 0, NAME_TBD, 1, 10),
6312 BPF_LINE_INFO_ENC(5, 0, NAME_TBD, 1, 10),
6313 BPF_LINE_INFO_ENC(6, 0, NAME_TBD, 1, 10),
6317 .nr_jited_ksyms = 1,
6320 .dead_func_cnt = 1,
6327 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6328 BTF_FUNC_PROTO_ENC(1, 1), /* [2] */
6329 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
6331 BTF_FUNC_ENC(NAME_TBD, 2), /* [4] */
6335 BTF_STR_SEC("\0int\0x\0dead\0main\0func\0int a=1+1;\0/* dead */"
6338 "\0return b + 1;\0return b + 1;\0return b + 1;"),
6341 BPF_MOV64_IMM(BPF_REG_2, 1),
6342 BPF_JMP_IMM(BPF_JGE, BPF_REG_2, 0, 1),
6348 BPF_CALL_REL(1),
6352 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
6358 .func_info = { {0, 4}, {7, 3}, {10, 5} },
6360 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6361 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 1, 10),
6362 BPF_LINE_INFO_ENC(4, 0, NAME_TBD, 1, 10),
6363 BPF_LINE_INFO_ENC(5, 0, NAME_TBD, 1, 10),
6364 BPF_LINE_INFO_ENC(6, 0, NAME_TBD, 1, 10),
6365 BPF_LINE_INFO_ENC(7, 0, NAME_TBD, 1, 10),
6366 BPF_LINE_INFO_ENC(8, 0, NAME_TBD, 1, 10),
6367 BPF_LINE_INFO_ENC(9, 0, NAME_TBD, 1, 10),
6368 BPF_LINE_INFO_ENC(10, 0, NAME_TBD, 1, 10),
6378 .dead_func_cnt = 1,
6385 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6386 BTF_FUNC_PROTO_ENC(1, 1), /* [2] */
6387 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
6389 BTF_FUNC_ENC(NAME_TBD, 2), /* [4] */
6393 BTF_STR_SEC("\0int\0x\0dead\0main\0func\0int a=1+1;\0/* live call */"
6395 "\0/* dead */\0return bla + 1;\0return bla + 1;"
6396 "\0return bla + 1;\0return func(a);\0b+=1;\0return b;"),
6398 BPF_MOV64_IMM(BPF_REG_2, 1),
6399 BPF_JMP_IMM(BPF_JGE, BPF_REG_2, 0, 1),
6405 BPF_CALL_REL(1),
6409 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
6415 .func_info = { {0, 4}, {6, 3}, {9, 5} },
6417 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6418 BPF_LINE_INFO_ENC(3, 0, NAME_TBD, 1, 10),
6419 BPF_LINE_INFO_ENC(4, 0, NAME_TBD, 1, 10),
6420 BPF_LINE_INFO_ENC(5, 0, NAME_TBD, 1, 10),
6421 BPF_LINE_INFO_ENC(6, 0, NAME_TBD, 1, 10),
6422 BPF_LINE_INFO_ENC(7, 0, NAME_TBD, 1, 10),
6423 BPF_LINE_INFO_ENC(8, 0, NAME_TBD, 1, 10),
6424 BPF_LINE_INFO_ENC(9, 0, NAME_TBD, 1, 10),
6425 BPF_LINE_INFO_ENC(11, 0, NAME_TBD, 1, 10),
6433 .dead_func_cnt = 1,
6440 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6441 BTF_FUNC_PROTO_ENC(1, 1), /* [2] */
6442 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
6444 BTF_FUNC_ENC(NAME_TBD, 2), /* [4] */
6450 BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 1, 3),
6461 .func_info = { {0, 3}, {6, 4}, },
6463 BPF_LINE_INFO_ENC(0, 0, NAME_TBD, 1, 10),
6464 BPF_LINE_INFO_ENC(6, 0, NAME_TBD, 1, 10),
6477 for (len = MAX_INSNS - 1; len > 0; --len) in probe_prog_length()
6480 return len + 1; in probe_prog_length()
6493 if (raw_u32_size == -1) in patch_name_tbd()
6494 return ERR_PTR(-EINVAL); in patch_name_tbd()
6503 return ERR_PTR(-ENOMEM); in patch_name_tbd()
6510 return ERR_PTR(-EINVAL); in patch_name_tbd()
6512 new_u32[i] = next_str - str; in patch_name_tbd()
6536 if (CHECK(err < 0, "invalid get info (1st) errno:%d", errno)) { in test_get_finfo()
6538 return -1; in test_get_finfo()
6540 nr_func_info = test->func_info_cnt - test->dead_func_cnt; in test_get_finfo()
6542 "incorrect info.nr_func_info (1st) %d", in test_get_finfo()
6544 return -1; in test_get_finfo()
6549 "incorrect info.func_info_rec_size (1st) %d", rec_size)) { in test_get_finfo()
6550 return -1; in test_get_finfo()
6558 return -1; in test_get_finfo()
6568 err = -1; in test_get_finfo()
6574 err = -1; in test_get_finfo()
6580 err = -1; in test_get_finfo()
6586 if (test->dead_func_mask & (1 << i)) in test_get_finfo()
6588 if (CHECK(finfo->type_id != test->func_info[i][1], in test_get_finfo()
6590 finfo->type_id, test->func_info[i][1])) { in test_get_finfo()
6591 err = -1; in test_get_finfo()
6622 if (test->nr_jited_ksyms) in test_get_linfo()
6623 nr_jited_ksyms = test->nr_jited_ksyms; in test_get_linfo()
6625 nr_jited_ksyms = test->func_info_cnt - test->dead_func_cnt; in test_get_linfo()
6631 err = -1; in test_get_linfo()
6638 nr_jited_ksyms = 1; in test_get_linfo()
6639 nr_jited_func_lens = 1; in test_get_linfo()
6652 err = -1; in test_get_linfo()
6661 err = -1; in test_get_linfo()
6675 err = -1; in test_get_linfo()
6690 err = -1; in test_get_linfo()
6723 err = -1; in test_get_linfo()
6728 while (test->dead_code_mask & (1 << dead_insns)) in test_get_linfo()
6733 for (i = 1; i < cnt; i++) { in test_get_linfo()
6736 while (test->dead_code_mask & (1 << (i + dead_insns))) in test_get_linfo()
6740 ((i + dead_insns) * test->line_info_rec_size); in test_get_linfo()
6741 if (CHECK(linfo[i].insn_off <= linfo[i - 1].insn_off, in test_get_linfo()
6744 i - 1, linfo[i - 1].insn_off)) { in test_get_linfo()
6745 err = -1; in test_get_linfo()
6748 if (CHECK(linfo[i].file_name_off != expected_linfo->file_name_off || in test_get_linfo()
6749 linfo[i].line_off != expected_linfo->line_off || in test_get_linfo()
6750 linfo[i].line_col != expected_linfo->line_col, in test_get_linfo()
6755 expected_linfo->file_name_off, in test_get_linfo()
6756 expected_linfo->line_off, in test_get_linfo()
6757 expected_linfo->line_col)) { in test_get_linfo()
6758 err = -1; in test_get_linfo()
6772 err = -1; in test_get_linfo()
6776 ksyms_found = 1; in test_get_linfo()
6779 for (i = 1; i < jited_cnt; i++) { in test_get_linfo()
6788 if (CHECK(jited_linfo[i] <= jited_linfo[i - 1], in test_get_linfo()
6791 i - 1, (long)(jited_linfo[i - 1]))) { in test_get_linfo()
6792 err = -1; in test_get_linfo()
6796 if (CHECK(jited_linfo[i] - cur_func_ksyms > cur_func_len, in test_get_linfo()
6797 "jited_linfo[%u]:%lx - %lx > %u", in test_get_linfo()
6800 err = -1; in test_get_linfo()
6808 err = -1; in test_get_linfo()
6824 const struct prog_info_raw_test *test = &info_raw_tests[test_num - 1]; in do_test_info_raw()
6826 int btf_fd = -1, prog_fd = -1, err = 0; in do_test_info_raw()
6831 if (!test__start_subtest(test->descr)) in do_test_info_raw()
6834 raw_btf = btf_raw_create(&hdr_tmpl, test->raw_types, in do_test_info_raw()
6835 test->str_sec, test->str_sec_size, in do_test_info_raw()
6845 err = -1; in do_test_info_raw()
6853 linfo_str_off = ret_next_str - test->str_sec; in do_test_info_raw()
6854 patched_linfo = patch_name_tbd(test->line_info, in do_test_info_raw()
6855 test->str_sec, linfo_str_off, in do_test_info_raw()
6856 test->str_sec_size, &linfo_size); in do_test_info_raw()
6860 err = -1; in do_test_info_raw()
6864 attr.prog_type = test->prog_type; in do_test_info_raw()
6865 attr.insns = ptr_to_u64(test->insns); in do_test_info_raw()
6866 attr.insn_cnt = probe_prog_length(test->insns); in do_test_info_raw()
6869 attr.func_info_rec_size = test->func_info_rec_size; in do_test_info_raw()
6870 attr.func_info_cnt = test->func_info_cnt; in do_test_info_raw()
6871 attr.func_info = ptr_to_u64(test->func_info); in do_test_info_raw()
6874 attr.log_level = 1; in do_test_info_raw()
6876 attr.line_info_rec_size = test->line_info_rec_size; in do_test_info_raw()
6882 err = ((prog_fd < 0) != test->expected_prog_load_failure); in do_test_info_raw()
6884 prog_fd, test->expected_prog_load_failure, errno) || in do_test_info_raw()
6885 CHECK(test->err_str && !strstr(btf_log_buf, test->err_str), in do_test_info_raw()
6886 "expected err_str:%s", test->err_str)) { in do_test_info_raw()
6887 err = -1; in do_test_info_raw()
6899 attr.line_info_cnt - test->dead_code_cnt, in do_test_info_raw()
6936 BTF_TYPE_INT_ENC(NAME_NTH(2), BTF_INT_SIGNED, 0, 32, 4),
6944 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 32, 4),
6955 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 32, 4),
6957 BTF_TYPE_INT_ENC(NAME_NTH(3), BTF_INT_SIGNED, 0, 32, 4),
6958 BTF_TYPE_INT_ENC(NAME_NTH(4), BTF_INT_SIGNED, 0, 64, 8),
6959 BTF_TYPE_INT_ENC(NAME_NTH(5), BTF_INT_SIGNED, 0, 32, 4),
6966 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 32, 4),
6974 .descr = "dedup: struct example #1",
6986 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 32, 4), /* [1] */
6988 BTF_TYPE_ARRAY_ENC(1, 1, 16), /* [2] */
6991 BTF_MEMBER_ENC(NAME_NTH(3), 4, 0), /* struct s *next; */
6992 BTF_MEMBER_ENC(NAME_NTH(4), 5, 64), /* const int *a; */
6994 BTF_MEMBER_ENC(NAME_NTH(6), 1, 640), /* int c; */
6996 /* ptr -> [3] struct s */
6997 BTF_PTR_ENC(3), /* [4] */
6998 /* ptr -> [6] const int */
7000 /* const -> [1] int */
7001 BTF_CONST_ENC(1), /* [6] */
7002 /* tag -> [3] struct s */
7003 BTF_DECL_TAG_ENC(NAME_NTH(2), 3, -1), /* [7] */
7004 /* tag -> [3] struct s, member 1 */
7005 BTF_DECL_TAG_ENC(NAME_NTH(2), 3, 1), /* [8] */
7008 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 32, 4), /* [9] */
7012 BTF_MEMBER_ENC(NAME_NTH(4), 13, 64),
7019 BTF_TYPE_FLOAT_ENC(NAME_NTH(7), 4), /* [15] */
7020 BTF_DECL_TAG_ENC(NAME_NTH(2), 11, -1), /* [16] */
7021 BTF_DECL_TAG_ENC(NAME_NTH(2), 11, 1), /* [17] */
7029 BTF_TYPE_INT_ENC(NAME_NTH(5), BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7031 BTF_TYPE_ARRAY_ENC(1, 1, 16), /* [2] */
7034 BTF_MEMBER_ENC(NAME_NTH(7), 4, 0), /* struct s *next; */
7035 BTF_MEMBER_ENC(NAME_NTH(1), 5, 64), /* const int *a; */
7037 BTF_MEMBER_ENC(NAME_NTH(3), 1, 640), /* int c; */
7038 BTF_MEMBER_ENC(NAME_NTH(4), 9, 672), /* float d; */
7039 /* ptr -> [3] struct s */
7040 BTF_PTR_ENC(3), /* [4] */
7041 /* ptr -> [6] const int */
7043 /* const -> [1] int */
7044 BTF_CONST_ENC(1), /* [6] */
7045 BTF_DECL_TAG_ENC(NAME_NTH(2), 3, -1), /* [7] */
7046 BTF_DECL_TAG_ENC(NAME_NTH(2), 3, 1), /* [8] */
7047 BTF_TYPE_FLOAT_ENC(NAME_NTH(7), 4), /* [9] */
7054 .descr = "dedup: struct <-> fwd resolution w/ hash collision",
7056 * // CU 1:
7069 /* CU 1 */
7070 BTF_FWD_ENC(NAME_TBD, 0 /* struct fwd */), /* [1] fwd x */
7071 BTF_PTR_ENC(1), /* [2] ptr -> [1] */
7072 BTF_STRUCT_ENC(NAME_TBD, 1, 8), /* [3] struct s */
7075 BTF_STRUCT_ENC(NAME_TBD, 0, 0), /* [4] struct x */
7076 BTF_PTR_ENC(4), /* [5] ptr -> [4] */
7077 BTF_STRUCT_ENC(NAME_TBD, 1, 8), /* [6] struct s */
7085 BTF_PTR_ENC(3), /* [1] ptr -> [3] */
7086 BTF_STRUCT_ENC(NAME_TBD, 1, 8), /* [2] struct s */
7087 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
7100 * // CU 1:
7111 /* CU 1 */
7112 BTF_STRUCT_ENC(0, 0, 1), /* [1] struct {} */
7113 BTF_PTR_ENC(1), /* [2] ptr -> [1] */
7114 BTF_STRUCT_ENC(NAME_NTH(1), 1, 8), /* [3] struct s */
7117 BTF_PTR_ENC(0), /* [4] ptr -> void */
7118 BTF_STRUCT_ENC(NAME_NTH(1), 1, 8), /* [5] struct s */
7119 BTF_MEMBER_ENC(NAME_NTH(2), 4, 0),
7126 /* CU 1 */
7127 BTF_STRUCT_ENC(0, 0, 1), /* [1] struct {} */
7128 BTF_PTR_ENC(1), /* [2] ptr -> [1] */
7129 BTF_STRUCT_ENC(NAME_NTH(1), 1, 8), /* [3] struct s */
7132 BTF_PTR_ENC(0), /* [4] ptr -> void */
7133 BTF_STRUCT_ENC(NAME_NTH(1), 1, 8), /* [5] struct s */
7134 BTF_MEMBER_ENC(NAME_NTH(2), 4, 0),
7147 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 8), /* [1] int */
7148 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 2), 4), /* [2] enum */
7150 BTF_ENUM_ENC(NAME_TBD, 1),
7151 BTF_FWD_ENC(NAME_TBD, 1 /* union kind_flag */), /* [3] fwd */
7152 BTF_TYPE_ARRAY_ENC(2, 1, 7), /* [4] array */
7153 BTF_STRUCT_ENC(NAME_TBD, 1, 4), /* [5] struct */
7154 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
7155 BTF_UNION_ENC(NAME_TBD, 1, 4), /* [6] union */
7156 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
7157 BTF_TYPEDEF_ENC(NAME_TBD, 1), /* [7] typedef */
7162 BTF_FUNC_PROTO_ENC(1, 2), /* [12] func_proto */
7163 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
7167 BTF_DECL_TAG_ENC(NAME_TBD, 13, -1), /* [15] decl_tag */
7168 BTF_DECL_TAG_ENC(NAME_TBD, 13, 1), /* [16] decl_tag */
7169 BTF_DECL_TAG_ENC(NAME_TBD, 7, -1), /* [17] decl_tag */
7173 BTF_ENUM64_ENC(NAME_TBD, 1, 1),
7180 BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 8), /* [1] int */
7181 BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_ENUM, 0, 2), 4), /* [2] enum */
7183 BTF_ENUM_ENC(NAME_TBD, 1),
7184 BTF_FWD_ENC(NAME_TBD, 1 /* union kind_flag */), /* [3] fwd */
7185 BTF_TYPE_ARRAY_ENC(2, 1, 7), /* [4] array */
7186 BTF_STRUCT_ENC(NAME_TBD, 1, 4), /* [5] struct */
7187 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
7188 BTF_UNION_ENC(NAME_TBD, 1, 4), /* [6] union */
7189 BTF_MEMBER_ENC(NAME_TBD, 1, 0),
7190 BTF_TYPEDEF_ENC(NAME_TBD, 1), /* [7] typedef */
7195 BTF_FUNC_PROTO_ENC(1, 2), /* [12] func_proto */
7196 BTF_FUNC_PROTO_ARG_ENC(NAME_TBD, 1),
7200 BTF_DECL_TAG_ENC(NAME_TBD, 13, -1), /* [15] decl_tag */
7201 BTF_DECL_TAG_ENC(NAME_TBD, 13, 1), /* [16] decl_tag */
7202 BTF_DECL_TAG_ENC(NAME_TBD, 7, -1), /* [17] decl_tag */
7206 BTF_ENUM64_ENC(NAME_TBD, 1, 1),
7216 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 32, 8),
7220 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_CHAR, 0, 32, 8),
7221 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_BOOL, 0, 32, 8),
7223 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 8, 32, 8),
7225 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 27, 8),
7227 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 32, 4),
7230 BTF_TYPE_FLOAT_ENC(NAME_NTH(3), 4),
7240 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 32, 8),
7244 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_CHAR, 0, 32, 8),
7245 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_BOOL, 0, 32, 8),
7247 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 8, 32, 8),
7249 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 27, 8),
7251 BTF_TYPE_INT_ENC(NAME_NTH(1), BTF_INT_SIGNED, 0, 32, 4),
7254 BTF_TYPE_FLOAT_ENC(NAME_NTH(3), 4),
7267 /* [1] fwd enum 'e1' before full enum */
7268 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 0), 4),
7270 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7273 BTF_TYPE_ENC(NAME_NTH(3), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7274 BTF_ENUM_ENC(NAME_NTH(4), 456),
7275 /* [4] fwd enum 'e2' after full enum */
7276 BTF_TYPE_ENC(NAME_NTH(3), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 0), 4),
7278 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 0), 1),
7280 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7288 /* [1] full enum 'e1' */
7289 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7292 BTF_TYPE_ENC(NAME_NTH(3), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7293 BTF_ENUM_ENC(NAME_NTH(4), 456),
7295 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7303 .descr = "dedup: datasec and vars pass-through",
7307 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7309 BTF_VAR_ENC(NAME_NTH(2), 1, 0), /* [2] */
7311 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
7312 BTF_VAR_SECINFO_ENC(2, 0, 4),
7314 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [4] */
7316 BTF_VAR_ENC(NAME_NTH(2), 4, 0), /* [5] */
7318 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
7319 BTF_VAR_SECINFO_ENC(5, 0, 4),
7327 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7329 BTF_VAR_ENC(NAME_NTH(2), 1, 0), /* [2] */
7331 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
7332 BTF_VAR_SECINFO_ENC(2, 0, 4),
7334 BTF_VAR_ENC(NAME_NTH(2), 1, 0), /* [4] */
7336 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 1), 4),
7337 BTF_VAR_SECINFO_ENC(4, 0, 4),
7351 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7353 BTF_VAR_ENC(NAME_NTH(1), 1, 0), /* [2] */
7356 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(2), 1),
7357 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(3), 1),
7358 BTF_FUNC_ENC(NAME_NTH(4), 3), /* [4] */
7359 /* tag -> t */
7360 BTF_DECL_TAG_ENC(NAME_NTH(5), 2, -1), /* [5] */
7361 BTF_DECL_TAG_ENC(NAME_NTH(5), 2, -1), /* [6] */
7362 /* tag -> func */
7363 BTF_DECL_TAG_ENC(NAME_NTH(5), 4, -1), /* [7] */
7364 BTF_DECL_TAG_ENC(NAME_NTH(5), 4, -1), /* [8] */
7365 /* tag -> func arg a1 */
7366 BTF_DECL_TAG_ENC(NAME_NTH(5), 4, 1), /* [9] */
7367 BTF_DECL_TAG_ENC(NAME_NTH(5), 4, 1), /* [10] */
7374 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7375 BTF_VAR_ENC(NAME_NTH(1), 1, 0), /* [2] */
7377 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(2), 1),
7378 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(3), 1),
7379 BTF_FUNC_ENC(NAME_NTH(4), 3), /* [4] */
7380 BTF_DECL_TAG_ENC(NAME_NTH(5), 2, -1), /* [5] */
7381 BTF_DECL_TAG_ENC(NAME_NTH(5), 4, -1), /* [6] */
7382 BTF_DECL_TAG_ENC(NAME_NTH(5), 4, 1), /* [7] */
7393 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7396 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(1), 1),
7397 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(2), 1),
7400 BTF_FUNC_PROTO_ENC(0, 2), /* [4] */
7401 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(1), 1),
7402 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(2), 1),
7403 BTF_FUNC_ENC(NAME_NTH(3), 4), /* [5] */
7404 /* tag -> f: tag1, tag2 */
7405 BTF_DECL_TAG_ENC(NAME_NTH(4), 3, -1), /* [6] */
7406 BTF_DECL_TAG_ENC(NAME_NTH(5), 3, -1), /* [7] */
7407 /* tag -> f/a2: tag1, tag2 */
7408 BTF_DECL_TAG_ENC(NAME_NTH(4), 3, 1), /* [8] */
7409 BTF_DECL_TAG_ENC(NAME_NTH(5), 3, 1), /* [9] */
7410 /* tag -> f: tag1, tag3 */
7411 BTF_DECL_TAG_ENC(NAME_NTH(4), 5, -1), /* [10] */
7412 BTF_DECL_TAG_ENC(NAME_NTH(6), 5, -1), /* [11] */
7413 /* tag -> f/a2: tag1, tag3 */
7414 BTF_DECL_TAG_ENC(NAME_NTH(4), 5, 1), /* [12] */
7415 BTF_DECL_TAG_ENC(NAME_NTH(6), 5, 1), /* [13] */
7422 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7424 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(1), 1),
7425 BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(2), 1),
7427 BTF_DECL_TAG_ENC(NAME_NTH(4), 3, -1), /* [4] */
7428 BTF_DECL_TAG_ENC(NAME_NTH(5), 3, -1), /* [5] */
7429 BTF_DECL_TAG_ENC(NAME_NTH(6), 3, -1), /* [6] */
7430 BTF_DECL_TAG_ENC(NAME_NTH(4), 3, 1), /* [7] */
7431 BTF_DECL_TAG_ENC(NAME_NTH(5), 3, 1), /* [8] */
7432 BTF_DECL_TAG_ENC(NAME_NTH(6), 3, 1), /* [9] */
7443 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7444 BTF_STRUCT_ENC(NAME_NTH(1), 2, 8), /* [2] */
7445 BTF_MEMBER_ENC(NAME_NTH(2), 1, 0),
7446 BTF_MEMBER_ENC(NAME_NTH(3), 1, 32),
7447 BTF_STRUCT_ENC(NAME_NTH(1), 2, 8), /* [3] */
7448 BTF_MEMBER_ENC(NAME_NTH(2), 1, 0),
7449 BTF_MEMBER_ENC(NAME_NTH(3), 1, 32),
7450 /* tag -> t: tag1, tag2 */
7451 BTF_DECL_TAG_ENC(NAME_NTH(4), 2, -1), /* [4] */
7452 BTF_DECL_TAG_ENC(NAME_NTH(5), 2, -1), /* [5] */
7453 /* tag -> t/m2: tag1, tag2 */
7454 BTF_DECL_TAG_ENC(NAME_NTH(4), 2, 1), /* [6] */
7455 BTF_DECL_TAG_ENC(NAME_NTH(5), 2, 1), /* [7] */
7456 /* tag -> t: tag1, tag3 */
7457 BTF_DECL_TAG_ENC(NAME_NTH(4), 3, -1), /* [8] */
7458 BTF_DECL_TAG_ENC(NAME_NTH(6), 3, -1), /* [9] */
7459 /* tag -> t/m2: tag1, tag3 */
7460 BTF_DECL_TAG_ENC(NAME_NTH(4), 3, 1), /* [10] */
7461 BTF_DECL_TAG_ENC(NAME_NTH(6), 3, 1), /* [11] */
7468 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7469 BTF_STRUCT_ENC(NAME_NTH(1), 2, 8), /* [2] */
7470 BTF_MEMBER_ENC(NAME_NTH(2), 1, 0),
7471 BTF_MEMBER_ENC(NAME_NTH(3), 1, 32),
7472 BTF_DECL_TAG_ENC(NAME_NTH(4), 2, -1), /* [3] */
7473 BTF_DECL_TAG_ENC(NAME_NTH(5), 2, -1), /* [4] */
7474 BTF_DECL_TAG_ENC(NAME_NTH(6), 2, -1), /* [5] */
7475 BTF_DECL_TAG_ENC(NAME_NTH(4), 2, 1), /* [6] */
7476 BTF_DECL_TAG_ENC(NAME_NTH(5), 2, 1), /* [7] */
7477 BTF_DECL_TAG_ENC(NAME_NTH(6), 2, 1), /* [8] */
7488 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7489 BTF_TYPEDEF_ENC(NAME_NTH(1), 1), /* [2] */
7490 BTF_TYPEDEF_ENC(NAME_NTH(1), 1), /* [3] */
7491 /* tag -> t: tag1, tag2 */
7492 BTF_DECL_TAG_ENC(NAME_NTH(2), 2, -1), /* [4] */
7493 BTF_DECL_TAG_ENC(NAME_NTH(3), 2, -1), /* [5] */
7494 /* tag -> t: tag1, tag3 */
7495 BTF_DECL_TAG_ENC(NAME_NTH(2), 3, -1), /* [6] */
7496 BTF_DECL_TAG_ENC(NAME_NTH(4), 3, -1), /* [7] */
7503 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7504 BTF_TYPEDEF_ENC(NAME_NTH(1), 1), /* [2] */
7505 BTF_DECL_TAG_ENC(NAME_NTH(2), 2, -1), /* [3] */
7506 BTF_DECL_TAG_ENC(NAME_NTH(3), 2, -1), /* [4] */
7507 BTF_DECL_TAG_ENC(NAME_NTH(4), 2, -1), /* [5] */
7514 .descr = "dedup: btf_type_tag #1",
7517 /* ptr -> tag2 -> tag1 -> int */
7518 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7519 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7521 BTF_PTR_ENC(3), /* [4] */
7522 /* ptr -> tag2 -> tag1 -> int */
7523 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [5] */
7526 /* ptr -> tag1 -> int */
7527 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [8] */
7535 /* ptr -> tag2 -> tag1 -> int */
7536 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7537 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7539 BTF_PTR_ENC(3), /* [4] */
7540 /* ptr -> tag1 -> int */
7551 /* ptr -> tag2 -> tag1 -> int */
7552 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7553 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7555 BTF_PTR_ENC(3), /* [4] */
7556 /* ptr -> tag2 -> int */
7557 BTF_TYPE_TAG_ENC(NAME_NTH(2), 1), /* [5] */
7565 /* ptr -> tag2 -> tag1 -> int */
7566 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7567 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7569 BTF_PTR_ENC(3), /* [4] */
7570 /* ptr -> tag2 -> int */
7571 BTF_TYPE_TAG_ENC(NAME_NTH(2), 1), /* [5] */
7582 /* ptr -> tag2 -> tag1 -> int */
7583 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7584 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7586 BTF_PTR_ENC(3), /* [4] */
7587 /* ptr -> tag1 -> tag2 -> int */
7588 BTF_TYPE_TAG_ENC(NAME_NTH(2), 1), /* [5] */
7589 BTF_TYPE_TAG_ENC(NAME_NTH(1), 5), /* [6] */
7597 /* ptr -> tag2 -> tag1 -> int */
7598 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7599 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7601 BTF_PTR_ENC(3), /* [4] */
7602 /* ptr -> tag1 -> tag2 -> int */
7603 BTF_TYPE_TAG_ENC(NAME_NTH(2), 1), /* [5] */
7604 BTF_TYPE_TAG_ENC(NAME_NTH(1), 5), /* [6] */
7612 .descr = "dedup: btf_type_tag #4",
7615 /* ptr -> tag1 -> int */
7616 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7617 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7619 /* ptr -> tag1 -> long */
7620 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 64, 8), /* [4] */
7621 BTF_TYPE_TAG_ENC(NAME_NTH(1), 4), /* [5] */
7629 /* ptr -> tag1 -> int */
7630 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7631 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7633 /* ptr -> tag1 -> long */
7634 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 64, 8), /* [4] */
7635 BTF_TYPE_TAG_ENC(NAME_NTH(1), 4), /* [5] */
7646 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7647 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7648 BTF_TYPE_ENC(NAME_NTH(2), BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 1), 4), /* [3] */
7650 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [4] */
7651 BTF_TYPE_ENC(NAME_NTH(2), BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 1), 4), /* [5] */
7652 BTF_MEMBER_ENC(NAME_NTH(3), 4, BTF_MEMBER_OFFSET(0, 0)),
7659 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
7660 BTF_TYPE_TAG_ENC(NAME_NTH(1), 1), /* [2] */
7661 BTF_TYPE_ENC(NAME_NTH(2), BTF_INFO_ENC(BTF_KIND_STRUCT, 1, 1), 4), /* [3] */
7672 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7673 BTF_ENUM64_ENC(NAME_NTH(2), 1, 123),
7674 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7675 BTF_ENUM64_ENC(NAME_NTH(2), 1, 123),
7682 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7683 BTF_ENUM64_ENC(NAME_NTH(2), 1, 123),
7693 /* [1] fwd enum64 'e1' before full enum */
7694 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 0), 8),
7696 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7697 BTF_ENUM64_ENC(NAME_NTH(2), 1, 123),
7699 BTF_TYPE_ENC(NAME_NTH(3), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7700 BTF_ENUM64_ENC(NAME_NTH(4), 0, 456),
7701 /* [4] fwd enum64 'e2' after full enum */
7704 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7712 /* [1] full enum64 'e1' */
7713 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7714 BTF_ENUM64_ENC(NAME_NTH(2), 1, 123),
7716 BTF_TYPE_ENC(NAME_NTH(3), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7717 BTF_ENUM64_ENC(NAME_NTH(4), 0, 456),
7719 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7730 /* [1] enum 'e1' */
7731 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7732 BTF_ENUM_ENC(NAME_NTH(2), 1),
7734 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 4),
7735 BTF_ENUM64_ENC(NAME_NTH(2), 1, 0),
7742 /* [1] enum 'e1' */
7743 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7744 BTF_ENUM_ENC(NAME_NTH(2), 1),
7746 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 4),
7747 BTF_ENUM64_ENC(NAME_NTH(2), 1, 0),
7757 /* [1] enum 'e1' */
7758 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7759 BTF_ENUM_ENC(NAME_NTH(2), 1),
7761 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 2),
7762 BTF_ENUM_ENC(NAME_NTH(2), 1),
7769 /* [1] enum 'e1' */
7770 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7771 BTF_ENUM_ENC(NAME_NTH(2), 1),
7773 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 2),
7774 BTF_ENUM_ENC(NAME_NTH(2), 1),
7784 /* [1] enum64 'e1' */
7785 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7786 BTF_ENUM64_ENC(NAME_NTH(2), 1, 0),
7788 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 0), 4),
7797 /* [1] enum64 'e1' */
7798 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 1), 8),
7799 BTF_ENUM64_ENC(NAME_NTH(2), 1, 0),
7801 BTF_TYPE_ENC(NAME_NTH(3), BTF_INFO_ENC(BTF_KIND_TYPEDEF, 0, 0), 1),
7811 /* [1] enum 'e1' */
7812 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7813 BTF_ENUM_ENC(NAME_NTH(2), 1),
7815 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM64, 0, 0), 8),
7824 /* [1] enum 'e1' */
7825 BTF_TYPE_ENC(NAME_NTH(1), BTF_INFO_ENC(BTF_KIND_ENUM, 0, 1), 4),
7826 BTF_ENUM_ENC(NAME_NTH(2), 1),
7828 BTF_TYPE_ENC(NAME_NTH(3), BTF_INFO_ENC(BTF_KIND_TYPEDEF, 0, 0), 1),
7840 * // CU 1:
7849 /* CU 1 */
7850 BTF_STRUCT_ENC(NAME_NTH(1), 1, 4), /* [1] */
7852 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
7854 BTF_FWD_ENC(NAME_NTH(1), 0), /* [3] */
7855 BTF_PTR_ENC(3), /* [4] */
7856 BTF_TYPEDEF_ENC(NAME_NTH(3), 4), /* [5] */
7863 BTF_STRUCT_ENC(NAME_NTH(1), 1, 4), /* [1] */
7865 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
7866 BTF_PTR_ENC(1), /* [3] */
7867 BTF_TYPEDEF_ENC(NAME_NTH(3), 3), /* [4] */
7880 * // CU 1:
7889 /* CU 1 */
7890 BTF_UNION_ENC(NAME_NTH(1), 1, 4), /* [1] */
7892 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
7894 BTF_FWD_ENC(NAME_TBD, 1), /* [3] */
7895 BTF_PTR_ENC(3), /* [4] */
7896 BTF_TYPEDEF_ENC(NAME_NTH(3), 4), /* [5] */
7903 BTF_UNION_ENC(NAME_NTH(1), 1, 4), /* [1] */
7905 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
7906 BTF_PTR_ENC(1), /* [3] */
7907 BTF_TYPEDEF_ENC(NAME_NTH(3), 3), /* [4] */
7917 * - CU1:foo is a struct, C2:foo is a union, thus CU2:foo is not deduped;
7918 * - typedef/ptr should remain unchanged as well.
7920 * // CU 1:
7929 /* CU 1 */
7930 BTF_STRUCT_ENC(NAME_NTH(1), 1, 4), /* [1] */
7932 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
7934 BTF_FWD_ENC(NAME_NTH(3), 1), /* [3] */
7935 BTF_PTR_ENC(3), /* [4] */
7936 BTF_TYPEDEF_ENC(NAME_NTH(3), 4), /* [5] */
7943 /* CU 1 */
7944 BTF_STRUCT_ENC(NAME_NTH(1), 1, 4), /* [1] */
7946 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
7948 BTF_FWD_ENC(NAME_NTH(3), 1), /* [3] */
7949 BTF_PTR_ENC(3), /* [4] */
7950 BTF_TYPEDEF_ENC(NAME_NTH(3), 4), /* [5] */
7960 * - two candidates for CU2:foo dedup, thus it is unchanged;
7961 * - typedef/ptr should remain unchanged as well.
7963 * // CU 1:
7975 /* CU 1 */
7976 BTF_STRUCT_ENC(NAME_NTH(1), 1, 4), /* [1] */
7978 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
7980 BTF_FWD_ENC(NAME_NTH(1), 0), /* [3] */
7981 BTF_PTR_ENC(3), /* [4] */
7982 BTF_TYPEDEF_ENC(NAME_NTH(4), 4), /* [5] */
7984 BTF_STRUCT_ENC(NAME_NTH(1), 2, 8), /* [6] */
7993 /* CU 1 */
7994 BTF_STRUCT_ENC(NAME_NTH(1), 1, 4), /* [1] */
7996 BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* [2] */
7998 BTF_FWD_ENC(NAME_NTH(1), 0), /* [3] */
7999 BTF_PTR_ENC(3), /* [4] */
8000 BTF_TYPEDEF_ENC(NAME_NTH(4), 4), /* [5] */
8002 BTF_STRUCT_ENC(NAME_NTH(1), 2, 8), /* [6] */
8015 __u16 vlen = BTF_INFO_VLEN(t->info); in btf_type_size()
8016 __u16 kind = BTF_INFO_KIND(t->info); in btf_type_size()
8050 return -EINVAL; in btf_type_size()
8061 cur += strlen(cur) + 1; in dump_btf_strings()
8068 struct btf_dedup_test *test = &dedup_tests[test_num - 1]; in do_test_dedup()
8081 if (!test__start_subtest(test->descr)) in do_test_dedup()
8084 raw_btf = btf_raw_create(&hdr_tmpl, test->input.raw_types, in do_test_dedup()
8085 test->input.str_sec, test->input.str_sec_size, in do_test_dedup()
8094 err = -1; in do_test_dedup()
8098 raw_btf = btf_raw_create(&hdr_tmpl, test->expect.raw_types, in do_test_dedup()
8099 test->expect.str_sec, in do_test_dedup()
8100 test->expect.str_sec_size, in do_test_dedup()
8108 err = -1; in do_test_dedup()
8112 test->opts.sz = sizeof(test->opts); in do_test_dedup()
8113 err = btf__dedup(test_btf, &test->opts); in do_test_dedup()
8115 err = -1; in do_test_dedup()
8124 err = -1; in do_test_dedup()
8129 test_strs = test_btf_data + sizeof(*test_hdr) + test_hdr->str_off; in do_test_dedup()
8131 expect_strs = expect_btf_data + sizeof(*test_hdr) + expect_hdr->str_off; in do_test_dedup()
8132 if (CHECK(test_hdr->str_len != expect_hdr->str_len, in do_test_dedup()
8133 "test_hdr->str_len:%u != expect_hdr->str_len:%u", in do_test_dedup()
8134 test_hdr->str_len, expect_hdr->str_len)) { in do_test_dedup()
8136 dump_btf_strings(test_strs, test_hdr->str_len); in do_test_dedup()
8138 dump_btf_strings(expect_strs, expect_hdr->str_len); in do_test_dedup()
8139 err = -1; in do_test_dedup()
8144 expect_str_end = expect_strs + expect_hdr->str_len; in do_test_dedup()
8151 err = -1; in do_test_dedup()
8162 err = -1; in do_test_dedup()
8168 err = -1; in do_test_dedup()
8171 expect_str_cur += expect_len + 1; in do_test_dedup()
8179 err = -1; in do_test_dedup()
8183 for (i = 1; i < test_nr_types; i++) { in do_test_dedup()
8195 err = -1; in do_test_dedup()
8201 err = -1; in do_test_dedup()
8204 if (CHECK(test_type->info != expect_type->info, in do_test_dedup()
8206 i, expect_type->info, test_type->info)) { in do_test_dedup()
8207 err = -1; in do_test_dedup()
8210 if (CHECK(test_type->size != expect_type->size, in do_test_dedup()
8212 i, expect_type->size, test_type->size)) { in do_test_dedup()
8213 err = -1; in do_test_dedup()
8229 for (i = 1; i <= ARRAY_SIZE(raw_tests); i++) in test_btf()
8231 for (i = 1; i <= ARRAY_SIZE(get_info_tests); i++) in test_btf()
8233 for (i = 1; i <= ARRAY_SIZE(file_tests); i++) in test_btf()
8235 for (i = 1; i <= ARRAY_SIZE(info_raw_tests); i++) in test_btf()
8237 for (i = 1; i <= ARRAY_SIZE(dedup_tests); i++) in test_btf()