@@ -879,6 +879,34 @@ static struct btf_raw_test raw_tests[] = {
879
879
.btf_load_err = true,
880
880
.err_str = "Invalid elem" ,
881
881
},
882
+ {
883
+ .descr = "var after datasec, ptr followed by modifier" ,
884
+ .raw_types = {
885
+ /* .bss section */ /* [1] */
886
+ BTF_TYPE_ENC (NAME_TBD , BTF_INFO_ENC (BTF_KIND_DATASEC , 0 , 2 ),
887
+ sizeof (void * )+4 ),
888
+ BTF_VAR_SECINFO_ENC (4 , 0 , sizeof (void * )),
889
+ BTF_VAR_SECINFO_ENC (6 , sizeof (void * ), 4 ),
890
+ /* int */ /* [2] */
891
+ BTF_TYPE_INT_ENC (0 , BTF_INT_SIGNED , 0 , 32 , 4 ),
892
+ /* int* */ /* [3] */
893
+ BTF_TYPE_ENC (0 , BTF_INFO_ENC (BTF_KIND_PTR , 0 , 0 ), 2 ),
894
+ BTF_VAR_ENC (NAME_TBD , 3 , 0 ), /* [4] */
895
+ /* const int */ /* [5] */
896
+ BTF_TYPE_ENC (0 , BTF_INFO_ENC (BTF_KIND_CONST , 0 , 0 ), 2 ),
897
+ BTF_VAR_ENC (NAME_TBD , 5 , 0 ), /* [6] */
898
+ BTF_END_RAW ,
899
+ },
900
+ .str_sec = "\0a\0b\0c\0" ,
901
+ .str_sec_size = sizeof ("\0a\0b\0c\0" ),
902
+ .map_type = BPF_MAP_TYPE_ARRAY ,
903
+ .map_name = ".bss" ,
904
+ .key_size = sizeof (int ),
905
+ .value_size = sizeof (void * )+4 ,
906
+ .key_type_id = 0 ,
907
+ .value_type_id = 1 ,
908
+ .max_entries = 1 ,
909
+ },
882
910
/* Test member exceeds the size of struct.
883
911
*
884
912
* struct A {
0 commit comments