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