1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. Copyright (C) 2015, 2020 embedded brains GmbH |
---|
4 | .. Copyright (C) 2015, 2020 Sebastian Huber |
---|
5 | |
---|
6 | .. index:: linkersets |
---|
7 | |
---|
8 | .. _linker_sets: |
---|
9 | |
---|
10 | Linker Sets |
---|
11 | *********** |
---|
12 | |
---|
13 | Introduction |
---|
14 | ============ |
---|
15 | |
---|
16 | Linker sets are a flexible means to create arrays of items out of a set of |
---|
17 | object files at link-time. For example its possible to define an item *I* of |
---|
18 | type *T* in object file *A* and an item *J* of type *T* in object file *B* to |
---|
19 | be a member of a linker set *S*. The linker will then collect these two items |
---|
20 | *I* and *J* and place them in consecutive memory locations, so that they can be |
---|
21 | accessed like a normal array defined in one object file. The size of a linker |
---|
22 | set is defined by its begin and end markers. A linker set may be empty. It |
---|
23 | should only contain items of the same type. |
---|
24 | |
---|
25 | The following macros are provided to create, populate and use linker sets. |
---|
26 | |
---|
27 | - RTEMS_LINKER_SET_BEGIN_ - Designator of the linker set begin marker |
---|
28 | |
---|
29 | - RTEMS_LINKER_SET_END_ - Designator of the linker set end marker |
---|
30 | |
---|
31 | - RTEMS_LINKER_SET_SIZE_ - The linker set size in characters |
---|
32 | |
---|
33 | - RTEMS_LINKER_SET_ITEM_COUNT_ - The linker set item count |
---|
34 | |
---|
35 | - RTEMS_LINKER_SET_IS_EMPTY_ - Is the linker set empty? |
---|
36 | |
---|
37 | - RTEMS_LINKER_SET_FOREACH_ - Iterate through the linker set items |
---|
38 | |
---|
39 | - RTEMS_LINKER_ROSET_DECLARE_ - Declares a read-only linker set |
---|
40 | |
---|
41 | - RTEMS_LINKER_ROSET_ - Defines a read-only linker set |
---|
42 | |
---|
43 | - RTEMS_LINKER_ROSET_ITEM_DECLARE_ - Declares a read-only linker set item |
---|
44 | |
---|
45 | - RTEMS_LINKER_ROSET_ITEM_ORDERED_DECLARE_ - Declares an ordered read-only linker set item |
---|
46 | |
---|
47 | - RTEMS_LINKER_ROSET_ITEM_REFERENCE_ - References a read-only linker set item |
---|
48 | |
---|
49 | - RTEMS_LINKER_ROSET_ITEM_ - Defines a read-only linker set item |
---|
50 | |
---|
51 | - RTEMS_LINKER_ROSET_ITEM_ORDERED_ - Defines an ordered read-only linker set item |
---|
52 | |
---|
53 | - RTEMS_LINKER_ROSET_CONTENT_ - Marks a declaration as a read-only linker set content |
---|
54 | |
---|
55 | - RTEMS_LINKER_RWSET_DECLARE_ - Declares a read-write linker set |
---|
56 | |
---|
57 | - RTEMS_LINKER_RWSET_ - Defines a read-write linker set |
---|
58 | |
---|
59 | - RTEMS_LINKER_RWSET_ITEM_DECLARE_ - Declares a read-write linker set item |
---|
60 | |
---|
61 | - RTEMS_LINKER_RWSET_ITEM_ORDERED_DECLARE_ - Declares an ordered read-write linker set item |
---|
62 | |
---|
63 | - RTEMS_LINKER_RWSET_ITEM_REFERENCE_ - References a read-write linker set item |
---|
64 | |
---|
65 | - RTEMS_LINKER_RWSET_ITEM_ - Defines a read-write linker set item |
---|
66 | |
---|
67 | - RTEMS_LINKER_RWSET_ITEM_ORDERED_ - Defines an ordered read-write linker set item |
---|
68 | |
---|
69 | - RTEMS_LINKER_RWSET_CONTENT_ - Marks a declaration as a read-write linker set content |
---|
70 | |
---|
71 | Background |
---|
72 | ========== |
---|
73 | |
---|
74 | Linker sets are used not only in RTEMS, but also for example in Linux, in |
---|
75 | FreeBSD, for the GNU C constructor extension and for global C++ constructors. |
---|
76 | They provide a space efficient and flexible means to initialize modules. A |
---|
77 | linker set consists of |
---|
78 | |
---|
79 | - dedicated input sections for the linker (e.g. ``.ctors`` and ``.ctors.*`` in |
---|
80 | the case of global constructors), |
---|
81 | |
---|
82 | - a begin marker (e.g. provided by ``crtbegin.o``, and |
---|
83 | |
---|
84 | - an end marker (e.g. provided by ``ctrend.o``). |
---|
85 | |
---|
86 | A module may place a certain data item into the dedicated input section. The |
---|
87 | linker will collect all such data items in this section and creates a begin and |
---|
88 | end marker. The initialization code can then use the begin and end markers to |
---|
89 | find all the collected data items (e.g. pointers to initialization functions). |
---|
90 | |
---|
91 | In the linker command file of the GNU linker we need the following output |
---|
92 | section descriptions. |
---|
93 | |
---|
94 | .. code-block:: c |
---|
95 | |
---|
96 | /* To be placed in a read-only memory region */ |
---|
97 | .rtemsroset : { |
---|
98 | KEEP (*(SORT(.rtemsroset.*))) |
---|
99 | } |
---|
100 | /* To be placed in a read-write memory region */ |
---|
101 | .rtemsrwset : { |
---|
102 | KEEP (*(SORT(.rtemsrwset.*))) |
---|
103 | } |
---|
104 | |
---|
105 | The ``KEEP()`` ensures that a garbage collection by the linker will not discard |
---|
106 | the content of this section. This would normally be the case since the linker |
---|
107 | set items are not referenced directly. The ``SORT()`` directive sorts the |
---|
108 | input sections lexicographically. Please note the lexicographical order of the |
---|
109 | ``.begin``, ``.content`` and ``.end`` section name parts in the RTEMS linker |
---|
110 | sets macros which ensures that the position of the begin and end markers are |
---|
111 | right. |
---|
112 | |
---|
113 | So, what is the benefit of using linker sets to initialize modules? It can be |
---|
114 | used to initialize and include only those RTEMS managers and other components |
---|
115 | which are used by the application. For example, in case an application uses |
---|
116 | message queues, it must call ``rtems_message_queue_create()``. In the module |
---|
117 | implementing this function, we can place a linker set item and register the |
---|
118 | message queue handler constructor. Otherwise, in case the application does not |
---|
119 | use message queues, there will be no reference to the |
---|
120 | ``rtems_message_queue_create()`` function and the constructor is not |
---|
121 | registered, thus nothing of the message queue handler will be in the final |
---|
122 | executable. |
---|
123 | |
---|
124 | For an example see test program :file:`sptests/splinkersets01`. |
---|
125 | |
---|
126 | Directives |
---|
127 | ========== |
---|
128 | |
---|
129 | .. raw:: latex |
---|
130 | |
---|
131 | \clearpage |
---|
132 | |
---|
133 | .. index:: RTEMS_LINKER_SET_BEGIN |
---|
134 | |
---|
135 | .. _RTEMS_LINKER_SET_BEGIN: |
---|
136 | |
---|
137 | RTEMS_LINKER_SET_BEGIN - Designator of the linker set begin marker |
---|
138 | ------------------------------------------------------------------ |
---|
139 | |
---|
140 | CALLING SEQUENCE: |
---|
141 | .. code-block:: c |
---|
142 | |
---|
143 | type *begin = RTEMS_LINKER_SET_BEGIN( set ); |
---|
144 | |
---|
145 | DESCRIPTION: |
---|
146 | This macro generates the designator of the begin marker of the linker set |
---|
147 | identified by ``set``. The item at the begin marker address is the first |
---|
148 | member of the linker set if it exists, e.g. the linker set is not empty. A |
---|
149 | linker set is empty, if and only if the begin and end markers have the same |
---|
150 | address. |
---|
151 | |
---|
152 | The ``set`` parameter itself must be a valid C designator on which no macro |
---|
153 | expansion is performed. It uniquely identifies the linker set. |
---|
154 | |
---|
155 | NOTE: |
---|
156 | The compiler may try to be smart. In general it will not work to assign linker |
---|
157 | set begin and end addresses to pointer variables and treat them like |
---|
158 | ordinary pointers. The compiler may exploit the fact that actually two |
---|
159 | distinct objects are involved and use this to optimize. To avoid trouble |
---|
160 | use :ref:`RTEMS_LINKER_SET_SIZE`, :ref:`RTEMS_LINKER_SET_ITEM_COUNT`, |
---|
161 | :ref:`RTEMS_LINKER_SET_IS_EMPTY` and :ref:`RTEMS_LINKER_SET_FOREACH`. |
---|
162 | |
---|
163 | .. raw:: latex |
---|
164 | |
---|
165 | \clearpage |
---|
166 | |
---|
167 | .. index:: RTEMS_LINKER_SET_END |
---|
168 | |
---|
169 | .. _RTEMS_LINKER_SET_END: |
---|
170 | |
---|
171 | RTEMS_LINKER_SET_END - Designator of the linker set end marker |
---|
172 | -------------------------------------------------------------- |
---|
173 | |
---|
174 | CALLING SEQUENCE: |
---|
175 | .. code-block:: c |
---|
176 | |
---|
177 | type *end = RTEMS_LINKER_SET_END( set ); |
---|
178 | |
---|
179 | DESCRIPTION: |
---|
180 | This macro generates the designator of the end marker of the linker set |
---|
181 | identified by ``set``. The item at the end marker address is not a member |
---|
182 | of the linker set. The ``set`` parameter itself must be a valid C |
---|
183 | designator on which no macro expansion is performed. It uniquely |
---|
184 | identifies the linker set. |
---|
185 | |
---|
186 | .. raw:: latex |
---|
187 | |
---|
188 | \clearpage |
---|
189 | |
---|
190 | .. index:: RTEMS_LINKER_SET_SIZE |
---|
191 | |
---|
192 | .. _RTEMS_LINKER_SET_SIZE: |
---|
193 | |
---|
194 | RTEMS_LINKER_SET_SIZE - The linker set size in characters |
---|
195 | --------------------------------------------------------- |
---|
196 | |
---|
197 | CALLING SEQUENCE: |
---|
198 | .. code-block:: c |
---|
199 | |
---|
200 | size_t size = RTEMS_LINKER_SET_SIZE( set ); |
---|
201 | |
---|
202 | DESCRIPTION: |
---|
203 | This macro returns the size of the linker set identified by ``set`` in |
---|
204 | characters. The ``set`` parameter itself must be a valid C designator on |
---|
205 | which no macro expansion is performed. It uniquely identifies the linker |
---|
206 | set. |
---|
207 | |
---|
208 | .. raw:: latex |
---|
209 | |
---|
210 | \clearpage |
---|
211 | |
---|
212 | .. index:: RTEMS_LINKER_SET_ITEM_COUNT |
---|
213 | |
---|
214 | .. _RTEMS_LINKER_SET_ITEM_COUNT: |
---|
215 | |
---|
216 | RTEMS_LINKER_SET_ITEM_COUNT - The linker set item count |
---|
217 | --------------------------------------------------------- |
---|
218 | |
---|
219 | CALLING SEQUENCE: |
---|
220 | .. code-block:: c |
---|
221 | |
---|
222 | size_t item_count = RTEMS_LINKER_SET_ITEM_COUNT( set ); |
---|
223 | |
---|
224 | DESCRIPTION: |
---|
225 | This macro returns the item count of the linker set identified by ``set``. |
---|
226 | The ``set`` parameter itself must be a valid C designator on which no macro |
---|
227 | expansion is performed. It uniquely identifies the linker set. |
---|
228 | |
---|
229 | .. raw:: latex |
---|
230 | |
---|
231 | \clearpage |
---|
232 | |
---|
233 | .. index:: RTEMS_LINKER_SET_IS_EMPTY |
---|
234 | |
---|
235 | .. _RTEMS_LINKER_SET_IS_EMPTY: |
---|
236 | |
---|
237 | RTEMS_LINKER_SET_IS_EMPTY - Is the linker set empty? |
---|
238 | --------------------------------------------------------- |
---|
239 | |
---|
240 | CALLING SEQUENCE: |
---|
241 | .. code-block:: c |
---|
242 | |
---|
243 | bool is_empty = RTEMS_LINKER_SET_IS_EMPTY( set ); |
---|
244 | |
---|
245 | DESCRIPTION: |
---|
246 | This macro returns true if the linker set identified by ``set`` is empty, |
---|
247 | otherwise returns false. The ``set`` parameter itself must be a valid C |
---|
248 | designator on which no macro expansion is performed. It uniquely |
---|
249 | identifies the linker set. |
---|
250 | |
---|
251 | .. raw:: latex |
---|
252 | |
---|
253 | \clearpage |
---|
254 | |
---|
255 | .. index:: RTEMS_LINKER_SET_FOREACH |
---|
256 | |
---|
257 | .. _RTEMS_LINKER_SET_FOREACH: |
---|
258 | |
---|
259 | RTEMS_LINKER_SET_FOREACH - Iterate through the linker set items |
---|
260 | --------------------------------------------------------- |
---|
261 | |
---|
262 | CALLING SEQUENCE: |
---|
263 | .. code-block:: c |
---|
264 | |
---|
265 | RTEMS_LINKER_RWSET( myset, int ); |
---|
266 | |
---|
267 | int count( void ) |
---|
268 | { |
---|
269 | int *item; |
---|
270 | int n; |
---|
271 | |
---|
272 | n = 0; |
---|
273 | RTEMS_LINKER_SET_FOREACH( myset, item ) { |
---|
274 | n += *item; |
---|
275 | } |
---|
276 | |
---|
277 | return n; |
---|
278 | } |
---|
279 | |
---|
280 | DESCRIPTION: |
---|
281 | This macro generates a for loop statement which iterates through each item |
---|
282 | of a linker set identified by ``set``. The ``set`` parameter itself must |
---|
283 | be a valid C designator on which no macro expansion is performed. It |
---|
284 | uniquely identifies the linker set. The ``item`` parameter must be a |
---|
285 | pointer to an item of the linker set. It iterates through all items of the |
---|
286 | linker set from begin to end. |
---|
287 | |
---|
288 | .. raw:: latex |
---|
289 | |
---|
290 | \clearpage |
---|
291 | |
---|
292 | .. index:: RTEMS_LINKER_ROSET_DECLARE |
---|
293 | |
---|
294 | .. _RTEMS_LINKER_ROSET_DECLARE: |
---|
295 | |
---|
296 | RTEMS_LINKER_ROSET_DECLARE - Declares a read-only linker set |
---|
297 | ------------------------------------------------------------ |
---|
298 | |
---|
299 | CALLING SEQUENCE: |
---|
300 | .. code-block:: c |
---|
301 | |
---|
302 | RTEMS_LINKER_ROSET_DECLARE( set, type ); |
---|
303 | |
---|
304 | DESCRIPTION: |
---|
305 | This macro generates declarations for the begin and end markers of a |
---|
306 | read-only linker set identified by ``set``. The ``set`` parameter itself |
---|
307 | must be a valid C designator on which no macro expansion is performed. It |
---|
308 | uniquely identifies the linker set. The ``type`` parameter defines the type |
---|
309 | of the linker set items. The type must be the same for all macro |
---|
310 | invocations of a particular linker set. |
---|
311 | |
---|
312 | .. raw:: latex |
---|
313 | |
---|
314 | \clearpage |
---|
315 | |
---|
316 | .. index:: RTEMS_LINKER_ROSET |
---|
317 | |
---|
318 | .. _RTEMS_LINKER_ROSET: |
---|
319 | |
---|
320 | RTEMS_LINKER_ROSET - Defines a read-only linker set |
---|
321 | --------------------------------------------------- |
---|
322 | |
---|
323 | CALLING SEQUENCE: |
---|
324 | .. code-block:: c |
---|
325 | |
---|
326 | RTEMS_LINKER_ROSET( set, type ); |
---|
327 | |
---|
328 | DESCRIPTION: |
---|
329 | This macro generates definitions for the begin and end markers of a |
---|
330 | read-only linker set identified by ``set``. The ``set`` parameter itself |
---|
331 | must be a valid C designator on which no macro expansion is performed. It |
---|
332 | uniquely identifies the linker set. The ``type`` parameter defines the type |
---|
333 | of the linker set items. The type must be the same for all macro |
---|
334 | invocations of a particular linker set. |
---|
335 | |
---|
336 | .. raw:: latex |
---|
337 | |
---|
338 | \clearpage |
---|
339 | |
---|
340 | .. index:: RTEMS_LINKER_ROSET_ITEM_DECLARE |
---|
341 | |
---|
342 | .. _RTEMS_LINKER_ROSET_ITEM_DECLARE: |
---|
343 | |
---|
344 | RTEMS_LINKER_ROSET_ITEM_DECLARE - Declares a read-only linker set item |
---|
345 | ---------------------------------------------------------------------- |
---|
346 | |
---|
347 | CALLING SEQUENCE: |
---|
348 | .. code-block:: c |
---|
349 | |
---|
350 | RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item ); |
---|
351 | |
---|
352 | DESCRIPTION: |
---|
353 | This macro generates a declaration of an item contained in the read-only |
---|
354 | linker set identified by ``set``. For a description of the ``set``, |
---|
355 | ``type``, and ``item`` parameters see :ref:`RTEMS_LINKER_ROSET_ITEM`. |
---|
356 | |
---|
357 | .. raw:: latex |
---|
358 | |
---|
359 | \clearpage |
---|
360 | |
---|
361 | .. index:: RTEMS_LINKER_ROSET_ITEM_ORDERED_DECLARE |
---|
362 | |
---|
363 | .. _RTEMS_LINKER_ROSET_ITEM_ORDERED_DECLARE: |
---|
364 | |
---|
365 | RTEMS_LINKER_ROSET_ITEM_ORDERED_DECLARE - Declares an ordered read-only linker set item |
---|
366 | --------------------------------------------------------------------------------------- |
---|
367 | |
---|
368 | CALLING SEQUENCE: |
---|
369 | .. code-block:: c |
---|
370 | |
---|
371 | RTEMS_LINKER_ROSET_ITEM_ORDERED_DECLARE( set, type, item, order ); |
---|
372 | |
---|
373 | DESCRIPTION: |
---|
374 | This macro generates a declaration of an ordered item contained in the |
---|
375 | read-only linker set identified by ``set``. For a description of the |
---|
376 | ``set``, ``type``, ``item``, and ``order`` parameters see |
---|
377 | :ref:`RTEMS_LINKER_ROSET_ITEM_ORDERED`. |
---|
378 | |
---|
379 | .. raw:: latex |
---|
380 | |
---|
381 | \clearpage |
---|
382 | |
---|
383 | .. index:: RTEMS_LINKER_ROSET_ITEM_REFERENCE |
---|
384 | |
---|
385 | .. _RTEMS_LINKER_ROSET_ITEM_REFERENCE: |
---|
386 | |
---|
387 | RTEMS_LINKER_ROSET_ITEM_REFERENCE - References a read-only linker set item |
---|
388 | -------------------------------------------------------------------------- |
---|
389 | |
---|
390 | CALLING SEQUENCE: |
---|
391 | .. code-block:: c |
---|
392 | |
---|
393 | RTEMS_LINKER_ROSET_ITEM_REFERENCE( set, type, item ); |
---|
394 | |
---|
395 | DESCRIPTION: |
---|
396 | This macro generates a reference to an item contained in the read-only |
---|
397 | linker set identified by ``set``. The ``set`` parameter itself must be a |
---|
398 | valid C designator on which no macro expansion is performed. It uniquely |
---|
399 | identifies the linker set. The ``type`` parameter defines the type of the |
---|
400 | linker set items. The type must be the same for all macro invocations of a |
---|
401 | particular linker set. The ``item`` parameter itself must be a valid C |
---|
402 | designator on which no macro expansion is performed. It uniquely |
---|
403 | identifies an item in the linker set. |
---|
404 | |
---|
405 | .. raw:: latex |
---|
406 | |
---|
407 | \clearpage |
---|
408 | |
---|
409 | .. index:: RTEMS_LINKER_ROSET_ITEM |
---|
410 | |
---|
411 | .. _RTEMS_LINKER_ROSET_ITEM: |
---|
412 | |
---|
413 | RTEMS_LINKER_ROSET_ITEM - Defines a read-only linker set item |
---|
414 | ------------------------------------------------------------- |
---|
415 | |
---|
416 | CALLING SEQUENCE: |
---|
417 | .. code-block:: c |
---|
418 | |
---|
419 | RTEMS_LINKER_ROSET_ITEM( set, type, item ); |
---|
420 | |
---|
421 | DESCRIPTION: |
---|
422 | This macro generates a definition of an item contained in the read-only |
---|
423 | linker set identified by ``set``. The ``set`` parameter itself must be a |
---|
424 | valid C designator on which no macro expansion is performed. It uniquely |
---|
425 | identifies the linker set. The ``type`` parameter defines the type of the |
---|
426 | linker set items. The type must be the same for all macro invocations of a |
---|
427 | particular linker set. The ``item`` parameter itself must be a valid C |
---|
428 | designator on which no macro expansion is performed. It uniquely |
---|
429 | identifies an item in the linker set. |
---|
430 | |
---|
431 | .. raw:: latex |
---|
432 | |
---|
433 | \clearpage |
---|
434 | |
---|
435 | .. index:: RTEMS_LINKER_ROSET_ITEM_ORDERED |
---|
436 | |
---|
437 | .. _RTEMS_LINKER_ROSET_ITEM_ORDERED: |
---|
438 | |
---|
439 | RTEMS_LINKER_ROSET_ITEM_ORDERED - Defines an ordered read-only linker set item |
---|
440 | ------------------------------------------------------------------------------ |
---|
441 | |
---|
442 | CALLING SEQUENCE: |
---|
443 | .. code-block:: c |
---|
444 | |
---|
445 | RTEMS_LINKER_ROSET_ITEM_ORDERED( set, type, item, order ); |
---|
446 | |
---|
447 | DESCRIPTION: |
---|
448 | This macro generates a definition of an ordered item contained in the |
---|
449 | read-only linker set identified by ``set``. The ``set`` parameter itself |
---|
450 | must be a valid C designator on which no macro expansion is performed. It |
---|
451 | uniquely identifies the linker set. The ``type`` parameter defines the type |
---|
452 | of the linker set items. The type must be the same for all macro |
---|
453 | invocations of a particular linker set. The ``item`` parameter itself must |
---|
454 | be a valid C designator on which no macro expansion is performed. It |
---|
455 | uniquely identifies an item in the linker set. The ``order`` parameter must |
---|
456 | be a valid linker input section name part on which macro expansion is |
---|
457 | performed. The items are lexicographically ordered according to the |
---|
458 | ``order`` parameter within a linker set. Ordered items are placed before |
---|
459 | unordered items in the linker set. |
---|
460 | |
---|
461 | NOTES: |
---|
462 | To be resilient to typos in the order parameter, it is recommended to use |
---|
463 | the following construct in macros defining items for a particular linker |
---|
464 | set (see enum in ``XYZ_ITEM()``). |
---|
465 | |
---|
466 | .. code-block:: c |
---|
467 | |
---|
468 | #include <rtems/linkersets.h> |
---|
469 | |
---|
470 | typedef struct { |
---|
471 | int foo; |
---|
472 | } xyz_item; |
---|
473 | |
---|
474 | /* The XYZ-order defines */ |
---|
475 | #define XYZ_ORDER_FIRST 0x00001000 |
---|
476 | #define XYZ_ORDER_AND_SO_ON 0x00002000 |
---|
477 | |
---|
478 | /* Defines an ordered XYZ-item */ |
---|
479 | #define XYZ_ITEM( item, order ) \ |
---|
480 | enum { xyz_##item = order }; \ |
---|
481 | RTEMS_LINKER_ROSET_ITEM_ORDERED( \ |
---|
482 | xyz, const xyz_item *, item, order \ |
---|
483 | ) = { &item } |
---|
484 | |
---|
485 | /* Example item */ |
---|
486 | static const xyz_item some_item = { 123 }; |
---|
487 | XYZ_ITEM( some_item, XYZ_ORDER_FIRST ); |
---|
488 | |
---|
489 | .. raw:: latex |
---|
490 | |
---|
491 | \clearpage |
---|
492 | |
---|
493 | .. index:: RTEMS_LINKER_ROSET_CONTENT |
---|
494 | |
---|
495 | .. _RTEMS_LINKER_ROSET_CONTENT: |
---|
496 | |
---|
497 | RTEMS_LINKER_ROSET_CONTENT - Marks a declaration as a read-only linker set content |
---|
498 | ---------------------------------------------------------------------------------- |
---|
499 | |
---|
500 | CALLING SEQUENCE: |
---|
501 | .. code-block:: c |
---|
502 | |
---|
503 | RTEMS_LINKER_ROSET_CONTENT( set, decl ); |
---|
504 | |
---|
505 | DESCRIPTION: |
---|
506 | This macro marks a declaration as a read-only linker set content. The |
---|
507 | linker set is identified by ``set``. The ``set`` parameter itself must be |
---|
508 | a valid C designator on which no macro expansion is performed. It uniquely |
---|
509 | identifies the linker set. The ``decl`` parameter must be an arbitrary |
---|
510 | variable declaration. |
---|
511 | |
---|
512 | .. raw:: latex |
---|
513 | |
---|
514 | \clearpage |
---|
515 | |
---|
516 | .. index:: RTEMS_LINKER_RWSET_DECLARE |
---|
517 | |
---|
518 | .. _RTEMS_LINKER_RWSET_DECLARE: |
---|
519 | |
---|
520 | RTEMS_LINKER_RWSET_DECLARE - Declares a read-write linker set |
---|
521 | ------------------------------------------------------------- |
---|
522 | |
---|
523 | CALLING SEQUENCE: |
---|
524 | .. code-block:: c |
---|
525 | |
---|
526 | RTEMS_LINKER_RWSET_DECLARE( set, type ); |
---|
527 | |
---|
528 | DESCRIPTION: |
---|
529 | This macro generates declarations for the begin and end markers of a |
---|
530 | read-write linker set identified by ``set``. The ``set`` parameter itself |
---|
531 | must be a valid C designator on which no macro expansion is performed. It |
---|
532 | uniquely identifies the linker set. The ``type`` parameter defines the type |
---|
533 | of the linker set items. The type must be the same for all macro |
---|
534 | invocations of a particular linker set. |
---|
535 | |
---|
536 | .. raw:: latex |
---|
537 | |
---|
538 | \clearpage |
---|
539 | |
---|
540 | .. index:: RTEMS_LINKER_RWSET |
---|
541 | |
---|
542 | .. _RTEMS_LINKER_RWSET: |
---|
543 | |
---|
544 | RTEMS_LINKER_RWSET - Defines a read-write linker set |
---|
545 | ---------------------------------------------------- |
---|
546 | |
---|
547 | CALLING SEQUENCE: |
---|
548 | .. code-block:: c |
---|
549 | |
---|
550 | RTEMS_LINKER_RWSET( set, type ); |
---|
551 | |
---|
552 | DESCRIPTION: |
---|
553 | This macro generates definitions for the begin and end markers of a |
---|
554 | read-write linker set identified by ``set``. The ``set`` parameter itself |
---|
555 | must be a valid C designator on which no macro expansion is performed. It |
---|
556 | uniquely identifies the linker set. The ``type`` parameter defines the type |
---|
557 | of the linker set items. The type must be the same for all macro |
---|
558 | invocations of a particular linker set. |
---|
559 | |
---|
560 | .. raw:: latex |
---|
561 | |
---|
562 | \clearpage |
---|
563 | |
---|
564 | .. index:: RTEMS_LINKER_RWSET_ITEM_DECLARE |
---|
565 | |
---|
566 | .. _RTEMS_LINKER_RWSET_ITEM_DECLARE: |
---|
567 | |
---|
568 | RTEMS_LINKER_RWSET_ITEM_DECLARE - Declares a read-write linker set item |
---|
569 | ----------------------------------------------------------------------- |
---|
570 | |
---|
571 | CALLING SEQUENCE: |
---|
572 | .. code-block:: c |
---|
573 | |
---|
574 | RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item ); |
---|
575 | |
---|
576 | DESCRIPTION: |
---|
577 | This macro generates a declaration of an item contained in the read-write |
---|
578 | linker set identified by ``set``. For a description of the ``set``, |
---|
579 | ``type``, and ``item`` parameters see :ref:`RTEMS_LINKER_RWSET_ITEM`. |
---|
580 | |
---|
581 | .. raw:: latex |
---|
582 | |
---|
583 | \clearpage |
---|
584 | |
---|
585 | .. index:: RTEMS_LINKER_RWSET_ITEM_ORDERED_DECLARE |
---|
586 | |
---|
587 | .. _RTEMS_LINKER_RWSET_ITEM_ORDERED_DECLARE: |
---|
588 | |
---|
589 | RTEMS_LINKER_RWSET_ITEM_ORDERED_DECLARE - Declares an ordered read-write linker set item |
---|
590 | ---------------------------------------------------------------------------------------- |
---|
591 | |
---|
592 | CALLING SEQUENCE: |
---|
593 | .. code-block:: c |
---|
594 | |
---|
595 | RTEMS_LINKER_RWSET_ITEM_ORDERED_DECLARE( set, type, item, order ); |
---|
596 | |
---|
597 | DESCRIPTION: |
---|
598 | This macro generates a declaration of an ordered item contained in the |
---|
599 | read-write linker set identified by ``set``. For a description of the |
---|
600 | ``set``, ``type``, ``item``, and ``order`` parameters see |
---|
601 | :ref:`RTEMS_LINKER_RWSET_ITEM_ORDERED`. |
---|
602 | |
---|
603 | .. raw:: latex |
---|
604 | |
---|
605 | \clearpage |
---|
606 | |
---|
607 | .. index:: RTEMS_LINKER_RWSET_ITEM_REFERENCE |
---|
608 | |
---|
609 | .. _RTEMS_LINKER_RWSET_ITEM_REFERENCE: |
---|
610 | |
---|
611 | RTEMS_LINKER_RWSET_ITEM_REFERENCE - References a read-write linker set item |
---|
612 | --------------------------------------------------------------------------- |
---|
613 | |
---|
614 | CALLING SEQUENCE: |
---|
615 | .. code-block:: c |
---|
616 | |
---|
617 | RTEMS_LINKER_RWSET_ITEM_REFERENCE( set, type, item ); |
---|
618 | |
---|
619 | DESCRIPTION: |
---|
620 | This macro generates a reference to an item contained in the read-write |
---|
621 | linker set identified by ``set``. The ``set`` parameter itself must be a |
---|
622 | valid C designator on which no macro expansion is performed. It uniquely |
---|
623 | identifies the linker set. The ``type`` parameter defines the type of the |
---|
624 | linker set items. The type must be the same for all macro invocations of a |
---|
625 | particular linker set. The ``item`` parameter itself must be a valid C |
---|
626 | designator on which no macro expansion is performed. It uniquely |
---|
627 | identifies an item in the linker set. |
---|
628 | |
---|
629 | .. raw:: latex |
---|
630 | |
---|
631 | \clearpage |
---|
632 | |
---|
633 | .. index:: RTEMS_LINKER_RWSET_ITEM |
---|
634 | |
---|
635 | .. _RTEMS_LINKER_RWSET_ITEM: |
---|
636 | |
---|
637 | RTEMS_LINKER_RWSET_ITEM - Defines a read-write linker set item |
---|
638 | -------------------------------------------------------------- |
---|
639 | |
---|
640 | CALLING SEQUENCE: |
---|
641 | .. code-block:: c |
---|
642 | |
---|
643 | RTEMS_LINKER_RWSET_ITEM( set, type, item ); |
---|
644 | |
---|
645 | DESCRIPTION: |
---|
646 | This macro generates a definition of an item contained in the read-write |
---|
647 | linker set identified by ``set``. The ``set`` parameter itself must be a |
---|
648 | valid C designator on which no macro expansion is performed. It uniquely |
---|
649 | identifies the linker set. The ``type`` parameter defines the type of the |
---|
650 | linker set items. The type must be the same for all macro invocations of a |
---|
651 | particular linker set. The ``item`` parameter itself must be a valid C |
---|
652 | designator on which no macro expansion is performed. It uniquely |
---|
653 | identifies an item in the linker set. |
---|
654 | |
---|
655 | .. raw:: latex |
---|
656 | |
---|
657 | \clearpage |
---|
658 | |
---|
659 | .. index:: RTEMS_LINKER_RWSET_ITEM_ORDERED |
---|
660 | |
---|
661 | .. _RTEMS_LINKER_RWSET_ITEM_ORDERED: |
---|
662 | |
---|
663 | RTEMS_LINKER_RWSET_ITEM_ORDERED - Defines an ordered read-write linker set item |
---|
664 | ------------------------------------------------------------------------------- |
---|
665 | |
---|
666 | CALLING SEQUENCE: |
---|
667 | .. code-block:: c |
---|
668 | |
---|
669 | RTEMS_LINKER_RWSET_ITEM_ORDERED( set, type, item, order ); |
---|
670 | |
---|
671 | DESCRIPTION: |
---|
672 | This macro generates a definition of an ordered item contained in the |
---|
673 | read-write linker set identified by ``set``. The ``set`` parameter itself |
---|
674 | must be a valid C designator on which no macro expansion is performed. It |
---|
675 | uniquely identifies the linker set. The ``type`` parameter defines the type |
---|
676 | of the linker set items. The type must be the same for all macro |
---|
677 | invocations of a particular linker set. The ``item`` parameter itself must |
---|
678 | be a valid C designator on which no macro expansion is performed. It |
---|
679 | uniquely identifies an item in the linker set. The ``order`` parameter must |
---|
680 | be a valid linker input section name part on which macro expansion is |
---|
681 | performed. The items are lexicographically ordered according to the |
---|
682 | ``order`` parameter within a linker set. Ordered items are placed before |
---|
683 | unordered items in the linker set. |
---|
684 | |
---|
685 | NOTES: |
---|
686 | To be resilient to typos in the order parameter, it is recommended to use |
---|
687 | the following construct in macros defining items for a particular linker |
---|
688 | set (see enum in ``XYZ_ITEM()``). |
---|
689 | |
---|
690 | .. code-block:: c |
---|
691 | |
---|
692 | #include <rtems/linkersets.h> |
---|
693 | |
---|
694 | typedef struct { |
---|
695 | int foo; |
---|
696 | } xyz_item; |
---|
697 | |
---|
698 | /* The XYZ-order defines */ |
---|
699 | #define XYZ_ORDER_FIRST 0x00001000 |
---|
700 | #define XYZ_ORDER_AND_SO_ON 0x00002000 |
---|
701 | |
---|
702 | /* Defines an ordered XYZ-item */ |
---|
703 | #define XYZ_ITEM( item, order ) \ |
---|
704 | enum { xyz_##item = order }; \ |
---|
705 | RTEMS_LINKER_RWSET_ITEM_ORDERED( \ |
---|
706 | xyz, const xyz_item *, item, order \ |
---|
707 | ) = { &item } |
---|
708 | |
---|
709 | /* Example item */ |
---|
710 | static const xyz_item some_item = { 123 }; |
---|
711 | XYZ_ITEM( some_item, XYZ_ORDER_FIRST ); |
---|
712 | |
---|
713 | .. raw:: latex |
---|
714 | |
---|
715 | \clearpage |
---|
716 | |
---|
717 | .. index:: RTEMS_LINKER_RWSET_CONTENT |
---|
718 | |
---|
719 | .. _RTEMS_LINKER_RWSET_CONTENT: |
---|
720 | |
---|
721 | RTEMS_LINKER_RWSET_CONTENT - Marks a declaration as a read-write linker set content |
---|
722 | ----------------------------------------------------------------------------------- |
---|
723 | |
---|
724 | CALLING SEQUENCE: |
---|
725 | .. code-block:: c |
---|
726 | |
---|
727 | RTEMS_LINKER_RWSET_CONTENT( set, decl ); |
---|
728 | |
---|
729 | DESCRIPTION: |
---|
730 | This macro marks a declaration as a read-write linker set content. The |
---|
731 | linker set is identified by ``set``. The ``set`` parameter itself must be |
---|
732 | a valid C designator on which no macro expansion is performed. It uniquely |
---|
733 | identifies the linker set. The ``decl`` parameter must be an arbitrary |
---|
734 | variable declaration. |
---|