|
42 | 42 | KEEP(*(SORT_BY_NAME(._##struct_type.static.*))); \
|
43 | 43 | _CONCAT(_##struct_type, _list_end) = .
|
44 | 44 |
|
| 45 | +#define Z_LINK_ITERABLE_GC_ALLOWED(struct_type) \ |
| 46 | + _CONCAT(_##struct_type, _list_start) = .; \ |
| 47 | + *(SORT_BY_NAME(._##struct_type.static.*)); \ |
| 48 | + _CONCAT(_##struct_type, _list_end) = . |
| 49 | + |
45 | 50 | /* Define an output section which will set up an iterable area
|
46 | 51 | * of equally-sized data structures. For use with Z_STRUCT_SECTION_ITERABLE.
|
47 | 52 | * Input sections will be sorted by name, per ld's SORT_BY_NAME.
|
48 | 53 | *
|
49 | 54 | * This macro should be used for read-only data.
|
| 55 | + * |
| 56 | + * Note that this keeps the symbols in the image even though |
| 57 | + * they are not being directly referenced. Use this when symbols |
| 58 | + * are indirectly referenced by iterating through the section. |
50 | 59 | */
|
51 | 60 | #define Z_ITERABLE_SECTION_ROM(struct_type, subalign) \
|
52 | 61 | SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
|
53 | 62 | { \
|
54 | 63 | Z_LINK_ITERABLE(struct_type); \
|
55 | 64 | } GROUP_LINK_IN(ROMABLE_REGION)
|
56 | 65 |
|
| 66 | +/* Define an output section which will set up an iterable area |
| 67 | + * of equally-sized data structures. For use with Z_STRUCT_SECTION_ITERABLE. |
| 68 | + * Input sections will be sorted by name, per ld's SORT_BY_NAME. |
| 69 | + * |
| 70 | + * This macro should be used for read-only data. |
| 71 | + * |
| 72 | + * Note that the symbols within the section can be garbage collected. |
| 73 | + */ |
| 74 | +#define Z_ITERABLE_SECTION_ROM_GC_ALLOWED(struct_type, subalign) \ |
| 75 | + SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \ |
| 76 | + { \ |
| 77 | + Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \ |
| 78 | + } GROUP_LINK_IN(ROMABLE_REGION) |
| 79 | + |
57 | 80 | /* Define an output section which will set up an iterable area
|
58 | 81 | * of equally-sized data structures. For use with Z_STRUCT_SECTION_ITERABLE.
|
59 | 82 | * Input sections will be sorted by name, per ld's SORT_BY_NAME.
|
60 | 83 | *
|
61 | 84 | * This macro should be used for read-write data that is modified at runtime.
|
| 85 | + * |
| 86 | + * Note that this keeps the symbols in the image even though |
| 87 | + * they are not being directly referenced. Use this when symbols |
| 88 | + * are indirectly referenced by iterating through the section. |
62 | 89 | */
|
63 | 90 | #define Z_ITERABLE_SECTION_RAM(struct_type, subalign) \
|
64 | 91 | SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
|
65 | 92 | { \
|
66 | 93 | Z_LINK_ITERABLE(struct_type); \
|
67 | 94 | } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
68 | 95 |
|
| 96 | + |
| 97 | +/* Define an output section which will set up an iterable area |
| 98 | + * of equally-sized data structures. For use with Z_STRUCT_SECTION_ITERABLE. |
| 99 | + * Input sections will be sorted by name, per ld's SORT_BY_NAME. |
| 100 | + * |
| 101 | + * This macro should be used for read-write data that is modified at runtime. |
| 102 | + * |
| 103 | + * Note that the symbols within the section can be garbage collected. |
| 104 | + */ |
| 105 | +#define Z_ITERABLE_SECTION_RAM_GC_ALLOWED(struct_type, subalign) \ |
| 106 | + SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \ |
| 107 | + { \ |
| 108 | + Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \ |
| 109 | + } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) |
| 110 | + |
69 | 111 | /*
|
70 | 112 | * generate a symbol to mark the start of the objects array for
|
71 | 113 | * the specified object and level, then link all of those objects
|
|
0 commit comments