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