1 /* { dg-do compile } */
2 /* { dg-skip-if "No section attribute" { { hppa*-*-hpux* } && { ! lp64 } } } */
3 /* { dg-options "-fpic -Os -g" } */
4 /* { dg-require-effective-target fpic } */
6 struct fit_loadable_tbl
{
8 void (*handler
)(int data
, int size
);
11 #define ll_entry_start(_type, _list) \
13 static char start[0] __attribute__((aligned(4))) \
14 __attribute__((unused, section(".u_boot_list_2_"#_list"_1"))); \
18 #define ll_entry_end(_type, _list) \
20 static char end[0] __attribute__((aligned(4))) \
21 __attribute__((unused, section(".u_boot_list_2_"#_list"_3"))); \
25 #define ll_entry_count(_type, _list) \
27 _type *start = ll_entry_start(_type, _list); \
28 _type *end = ll_entry_end(_type, _list); \
29 unsigned int _ll_result = end - start; \
33 void test(int img_type
, int img_data
, int img_len
)
36 const unsigned int count
=
37 ll_entry_count(struct fit_loadable_tbl
, fit_loadable
);
38 struct fit_loadable_tbl
*fit_loadable_handler
=
39 ll_entry_start(struct fit_loadable_tbl
, fit_loadable
);
41 for (i
= 0; i
< count
; i
++, fit_loadable_handler
++)
42 if (fit_loadable_handler
->type
== img_type
)
43 fit_loadable_handler
->handler(img_data
, img_len
);