summaryrefslogtreecommitdiffstats
path: root/c_user/linker_sets.rst
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-02-18 15:29:28 +1100
committerAmar Takhar <verm@darkbeer.org>2016-05-02 20:51:26 -0400
commit0d86b7111e378286bd61613c363c06cec39d0538 (patch)
treedb53c1ba4c2ac32c0a1420bfc9074f4c2b526445 /c_user/linker_sets.rst
parentAdd semaphore attributes figure. (diff)
downloadrtems-docs-0d86b7111e378286bd61613c363c06cec39d0538.tar.bz2
Clean up.
Diffstat (limited to 'c_user/linker_sets.rst')
-rw-r--r--c_user/linker_sets.rst363
1 files changed, 216 insertions, 147 deletions
diff --git a/c_user/linker_sets.rst b/c_user/linker_sets.rst
index d314758..51dfd78 100644
--- a/c_user/linker_sets.rst
+++ b/c_user/linker_sets.rst
@@ -1,3 +1,7 @@
+.. COMMENT: COPYRIGHT (c) 1989-2014.
+.. COMMENT: On-Line Applications Research Corporation (OAR).
+.. COMMENT: All rights reserved.
+
Linker Sets
###########
@@ -7,46 +11,45 @@ Introduction
============
Linker sets are a flexible means to create arrays of items out of a set of
-object files at link-time. For example its possible to define an item *I*
-of type *T* in object file *A* and an item *J* of type *T*
-in object file *B* to be a member of a linker set *S*. The linker
-will then collect these two items *I* and *J* and place them in
-consecutive memory locations, so that they can be accessed like a normal array
-defined in one object file. The size of a linker set is defined by its begin
-and end markers. A linker set may be empty. It should only contain items of
-the same type.
+object files at link-time. For example its possible to define an item *I* of
+type *T* in object file *A* and an item *J* of type *T* in object file *B* to
+be a member of a linker set *S*. The linker will then collect these two items
+*I* and *J* and place them in consecutive memory locations, so that they can be
+accessed like a normal array defined in one object file. The size of a linker
+set is defined by its begin and end markers. A linker set may be empty. It
+should only contain items of the same type.
The following macros are provided to create, populate and use linker sets.
-- ``RTEMS_LINKER_SET_BEGIN`` - Designator of the linker set begin marker
+- RTEMS_LINKER_SET_BEGIN_ - Designator of the linker set begin marker
-- ``RTEMS_LINKER_SET_END`` - Designator of the linker set end marker
+- RTEMS_LINKER_SET_END_ - Designator of the linker set end marker
-- ``RTEMS_LINKER_SET_SIZE`` - The linker set size in characters
+- RTEMS_LINKER_SET_SIZE_ - The linker set size in characters
-- ``RTEMS_LINKER_ROSET_DECLARE`` - Declares a read-only linker set
+- RTEMS_LINKER_ROSET_DECLARE_ - Declares a read-only linker set
-- ``RTEMS_LINKER_ROSET`` - Defines a read-only linker set
+- RTEMS_LINKER_ROSET_ - Defines a read-only linker set
-- ``RTEMS_LINKER_ROSET_ITEM_DECLARE`` - Declares a read-only linker set item
+- RTEMS_LINKER_ROSET_ITEM_DECLARE_ - Declares a read-only linker set item
-- ``RTEMS_LINKER_ROSET_ITEM_REFERENCE`` - References a read-only linker set item
+- RTEMS_LINKER_ROSET_ITEM_REFERENCE_ - References a read-only linker set item
-- ``RTEMS_LINKER_ROSET_ITEM`` - Defines a read-only linker set item
+- RTEMS_LINKER_ROSET_ITEM_ - Defines a read-only linker set item
-- ``RTEMS_LINKER_ROSET_ITEM_ORDERED`` - Defines an ordered read-only linker set item
+- RTEMS_LINKER_ROSET_ITEM_ORDERED_ - Defines an ordered read-only linker set item
-- ``RTEMS_LINKER_RWSET_DECLARE`` - Declares a read-write linker set
+- RTEMS_LINKER_RWSET_DECLARE_ - Declares a read-write linker set
-- ``RTEMS_LINKER_RWSET`` - Defines a read-write linker set
+- RTEMS_LINKER_RWSET_ - Defines a read-write linker set
-- ``RTEMS_LINKER_RWSET_ITEM_DECLARE`` - Declares a read-write linker set item
+- RTEMS_LINKER_RWSET_ITEM_DECLARE_ - Declares a read-write linker set item
-- ``RTEMS_LINKER_RWSET_ITEM_REFERENCE`` - References a read-write linker set item
+- RTEMS_LINKER_RWSET_ITEM_REFERENCE_ - References a read-write linker set item
-- ``RTEMS_LINKER_RWSET_ITEM`` - Defines a read-write linker set item
+- RTEMS_LINKER_RWSET_ITEM_ - Defines a read-write linker set item
-- ``RTEMS_LINKER_RWSET_ITEM_ORDERED`` - Defines an ordered read-write linker set item
+- RTEMS_LINKER_RWSET_ITEM_ORDERED_ - Defines an ordered read-write linker set item
Background
==========
@@ -56,7 +59,8 @@ FreeBSD, for the GNU C constructor extension and for global C++ constructors.
They provide a space efficient and flexible means to initialize modules. A
linker set consists of
-- dedicated input sections for the linker (e.g. ``.ctors`` and``.ctors.*`` in the case of global constructors),
+- dedicated input sections for the linker (e.g. ``.ctors`` and ``.ctors.*`` in
+ the case of global constructors),
- a begin marker (e.g. provided by ``crtbegin.o``, and
@@ -69,32 +73,34 @@ find all the collected data items (e.g. pointers to initialization functions).
In the linker command file of the GNU linker we need the following output
section descriptions.
-.. code:: c
- /* To be placed in a read-only memory region \*/
+.. code-block:: c
+
+ /* To be placed in a read-only memory region */
.rtemsroset : {
- KEEP (\*(SORT(.rtemsroset.*)))
+ KEEP (\*(SORT(.rtemsroset.*)))
}
- /* To be placed in a read-write memory region \*/
+ /* To be placed in a read-write memory region */
.rtemsrwset : {
- KEEP (\*(SORT(.rtemsrwset.*)))
+ KEEP (\*(SORT(.rtemsrwset.*)))
}
-The ``KEEP()`` ensures that a garbage collection by the linker will not
-discard the content of this section. This would normally be the case since the
-linker set items are not referenced directly. The ``SORT()`` directive
-sorts the input sections lexicographically. Please note the lexicographical
-order of the ``.begin``, ``.content`` and ``.end`` section name parts
-in the RTEMS linker sets macros which ensures that the position of the begin
-and end markers are right.
+The ``KEEP()`` ensures that a garbage collection by the linker will not discard
+the content of this section. This would normally be the case since the linker
+set items are not referenced directly. The ``SORT()`` directive sorts the
+input sections lexicographically. Please note the lexicographical order of the
+``.begin``, ``.content`` and ``.end`` section name parts in the RTEMS linker
+sets macros which ensures that the position of the begin and end markers are
+right.
So, what is the benefit of using linker sets to initialize modules? It can be
used to initialize and include only those RTEMS managers and other components
which are used by the application. For example, in case an application uses
-message queues, it must call ``rtems_message_queue_create()``. In the
-module implementing this function, we can place a linker set item and register
-the message queue handler constructor. Otherwise, in case the application does
-not use message queues, there will be no reference to the``rtems_message_queue_create()`` function and the constructor is not
+message queues, it must call ``rtems_message_queue_create()``. In the module
+implementing this function, we can place a linker set item and register the
+message queue handler constructor. Otherwise, in case the application does not
+use message queues, there will be no reference to the
+``rtems_message_queue_create()`` function and the constructor is not
registered, thus nothing of the message queue handler will be in the final
executable.
@@ -103,6 +109,8 @@ For an example see test program :file:`sptests/splinkersets01`.
Directives
==========
+.. _RTEMS_LINKER_SET_BEGIN:
+
RTEMS_LINKER_SET_BEGIN - Designator of the linker set begin marker
------------------------------------------------------------------
@@ -110,9 +118,9 @@ RTEMS_LINKER_SET_BEGIN - Designator of the linker set begin marker
.. index:: RTEMS_LINKER_SET_BEGIN
-.. code:: c
+.. code-block:: c
- volatile type \*begin = RTEMS_LINKER_SET_BEGIN( set );
+ volatile type *begin = RTEMS_LINKER_SET_BEGIN( set );
**DESCRIPTION:**
@@ -121,9 +129,12 @@ identified by ``set``. The item at the begin marker address is the first
member of the linker set if it exists, e.g. the linker set is not empty. A
linker set is empty, if and only if the begin and end markers have the same
address.
+
The ``set`` parameter itself must be a valid C designator on which no macro
expansion is performed. It uniquely identifies the linker set.
+.. _RTEMS_LINKER_SET_END:
+
RTEMS_LINKER_SET_END - Designator of the linker set end marker
--------------------------------------------------------------
@@ -131,16 +142,18 @@ RTEMS_LINKER_SET_END - Designator of the linker set end marker
.. index:: RTEMS_LINKER_SET_END
-.. code:: c
+.. code-block:: c
- volatile type \*end = RTEMS_LINKER_SET_END( set );
+ volatile type *end = RTEMS_LINKER_SET_END( set );
**DESCRIPTION:**
This macro generates the designator of the end marker of the linker set
-identified by ``set``. The item at the end marker address is not a member
-of the linker set. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set.
+identified by ``set``. The item at the end marker address is not a member of
+the linker set. The ``set`` parameter itself must be a valid C designator on
+which no macro expansion is performed. It uniquely identifies the linker set.
+
+.. _RTEMS_LINKER_SET_SIZE:
RTEMS_LINKER_SET_SIZE - The linker set size in characters
---------------------------------------------------------
@@ -149,15 +162,17 @@ RTEMS_LINKER_SET_SIZE - The linker set size in characters
.. index:: RTEMS_LINKER_SET_SIZE
-.. code:: c
+.. code-block:: c
size_t size = RTEMS_LINKER_SET_SIZE( set );
**DESCRIPTION:**
This macro returns the size of the linker set identified by ``set`` in
-characters. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set.
+characters. The ``set`` parameter itself must be a valid C designator on which
+no macro expansion is performed. It uniquely identifies the linker set.
+
+.. _RTEMS_LINKER_ROSET_DECLARE:
RTEMS_LINKER_ROSET_DECLARE - Declares a read-only linker set
------------------------------------------------------------
@@ -166,16 +181,20 @@ RTEMS_LINKER_ROSET_DECLARE - Declares a read-only linker set
.. index:: RTEMS_LINKER_ROSET_DECLARE
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_ROSET_DECLARE( set, type );
**DESCRIPTION:**
This macro generates declarations for the begin and end markers of a read-only
-linker set identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set.
+linker set identified by ``set``. The ``set`` parameter itself must be a valid
+C designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set.
+
+.. _RTEMS_LINKER_ROSET:
RTEMS_LINKER_ROSET - Defines a read-only linker set
---------------------------------------------------
@@ -184,16 +203,20 @@ RTEMS_LINKER_ROSET - Defines a read-only linker set
.. index:: RTEMS_LINKER_ROSET
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_ROSET( set, type );
**DESCRIPTION:**
This macro generates definitions for the begin and end markers of a read-only
-linker set identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set.
+linker set identified by ``set``. The ``set`` parameter itself must be a valid
+C designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set.
+
+.. _RTEMS_LINKER_ROSET_ITEM_DECLARE:
RTEMS_LINKER_ROSET_ITEM_DECLARE - Declares a read-only linker set item
----------------------------------------------------------------------
@@ -202,17 +225,22 @@ RTEMS_LINKER_ROSET_ITEM_DECLARE - Declares a read-only linker set item
.. index:: RTEMS_LINKER_ROSET_ITEM_DECLARE
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item );
**DESCRIPTION:**
This macro generates a declaration of an item contained in the read-only linker
-set identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set. The ``item`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies an item in the linker set.
+set identified by ``set``. The ``set`` parameter itself must be a valid C
+designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set. The ``item`` parameter itself must be a valid C designator on which
+no macro expansion is performed. It uniquely identifies an item in the linker
+set.
+
+.. _RTEMS_LINKER_ROSET_ITEM_REFERENCE:
RTEMS_LINKER_ROSET_ITEM_REFERENCE - References a read-only linker set item
--------------------------------------------------------------------------
@@ -221,17 +249,22 @@ RTEMS_LINKER_ROSET_ITEM_REFERENCE - References a read-only linker set item
.. index:: RTEMS_LINKER_ROSET_ITEM_REFERENCE
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_ROSET_ITEM_REFERENCE( set, type, item );
**DESCRIPTION:**
-This macro generates a reference to an item contained in the read-only linker set
-identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set. The ``item`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies an item in the linker set.
+This macro generates a reference to an item contained in the read-only linker
+set identified by ``set``. The ``set`` parameter itself must be a valid C
+designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set. The ``item`` parameter itself must be a valid C designator on which
+no macro expansion is performed. It uniquely identifies an item in the linker
+set.
+
+.. _RTEMS_LINKER_ROSET_ITEM:
RTEMS_LINKER_ROSET_ITEM - Defines a read-only linker set item
-------------------------------------------------------------
@@ -240,17 +273,22 @@ RTEMS_LINKER_ROSET_ITEM - Defines a read-only linker set item
.. index:: RTEMS_LINKER_ROSET_ITEM
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_ROSET_ITEM( set, type, item );
**DESCRIPTION:**
-This macro generates a definition of an item contained in the read-only linker set
-identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set. The ``item`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies an item in the linker set.
+This macro generates a definition of an item contained in the read-only linker
+set identified by ``set``. The ``set`` parameter itself must be a valid C
+designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set. The ``item`` parameter itself must be a valid C designator on which
+no macro expansion is performed. It uniquely identifies an item in the linker
+set.
+
+.. _RTEMS_LINKER_ROSET_ITEM_ORDERED:
RTEMS_LINKER_ROSET_ITEM_ORDERED - Defines an ordered read-only linker set item
------------------------------------------------------------------------------
@@ -259,46 +297,55 @@ RTEMS_LINKER_ROSET_ITEM_ORDERED - Defines an ordered read-only linker set item
.. index:: RTEMS_LINKER_ROSET_ITEM_ORDERED
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_ROSET_ITEM_ORDERED( set, type, item, order );
**DESCRIPTION:**
This macro generates a definition of an ordered item contained in the read-only
-linker set identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set.
-The ``item`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies an item in the linker set. The ``order`` parameter must be a valid linker input section name part on
-which macro expansion is performed. The items are lexicographically ordered
-according to the ``order`` parameter within a linker set. Ordered items are
-placed before unordered items in the linker set.
+linker set identified by ``set``. The ``set`` parameter itself must be a valid
+C designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set. The ``item`` parameter itself must be a valid C designator on
+which no macro expansion is performed. It uniquely identifies an item in the
+linker set. The ``order`` parameter must be a valid linker input section name
+part on which macro expansion is performed. The items are lexicographically
+ordered according to the ``order`` parameter within a linker set. Ordered
+items are placed before unordered items in the linker set.
**NOTES:**
To be resilient to typos in the order parameter, it is recommended to use the
following construct in macros defining items for a particular linker set (see
enum in ``XYZ_ITEM()``).
-.. code:: c
+
+.. code-block:: c
#include <rtems/linkersets.h>
+
typedef struct {
- int foo;
+ int foo;
} xyz_item;
- /* The XYZ-order defines \*/
+
+ /* The XYZ-order defines */
#define XYZ_ORDER_FIRST 0x00001000
#define XYZ_ORDER_AND_SO_ON 0x00002000
- /* Defines an ordered XYZ-item \*/
- #define XYZ_ITEM( item, order ) \\
- enum { xyz_##item = order - order }; \\
- RTEMS_LINKER_ROSET_ITEM_ORDERED( \\
- xyz, const xyz_item \*, item, order \\
- ) = { &item }
- /* Example item \*/
+
+ /* Defines an ordered XYZ-item */
+ #define XYZ_ITEM( item, order ) \
+ enum { xyz_##item = order - order }; \
+ RTEMS_LINKER_ROSET_ITEM_ORDERED( \
+ xyz, const xyz_item *, item, order \
+ ) = { &item }
+
+ /* Example item */
static const xyz_item some_item = { 123 };
XYZ_ITEM( some_item, XYZ_ORDER_FIRST );
+.. _RTEMS_LINKER_RWSET_DECLARE:
+
RTEMS_LINKER_RWSET_DECLARE - Declares a read-write linker set
-------------------------------------------------------------
@@ -306,16 +353,20 @@ RTEMS_LINKER_RWSET_DECLARE - Declares a read-write linker set
.. index:: RTEMS_LINKER_RWSET_DECLARE
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_RWSET_DECLARE( set, type );
**DESCRIPTION:**
This macro generates declarations for the begin and end markers of a read-write
-linker set identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set.
+linker set identified by ``set``. The ``set`` parameter itself must be a valid
+C designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set.
+
+.. _RTEMS_LINKER_RWSET:
RTEMS_LINKER_RWSET - Defines a read-write linker set
----------------------------------------------------
@@ -324,16 +375,20 @@ RTEMS_LINKER_RWSET - Defines a read-write linker set
.. index:: RTEMS_LINKER_RWSET
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_RWSET( set, type );
**DESCRIPTION:**
This macro generates definitions for the begin and end markers of a read-write
-linker set identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set.
+linker set identified by ``set``. The ``set`` parameter itself must be a valid
+C designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set.
+
+.. _RTEMS_LINKER_RWSET_ITEM_DECLARE:
RTEMS_LINKER_RWSET_ITEM_DECLARE - Declares a read-write linker set item
-----------------------------------------------------------------------
@@ -342,17 +397,22 @@ RTEMS_LINKER_RWSET_ITEM_DECLARE - Declares a read-write linker set item
.. index:: RTEMS_LINKER_RWSET_ITEM_DECLARE
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item );
**DESCRIPTION:**
-This macro generates a declaration of an item contained in the read-write linker
-set identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set. The ``item`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies an item in the linker set.
+This macro generates a declaration of an item contained in the read-write
+linker set identified by ``set``. The ``set`` parameter itself must be a valid
+C designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set. The ``item`` parameter itself must be a valid C designator on which
+no macro expansion is performed. It uniquely identifies an item in the linker
+set.
+
+.. _RTEMS_LINKER_RWSET_ITEM_REFERENCE:
RTEMS_LINKER_RWSET_ITEM_REFERENCE - References a read-write linker set item
---------------------------------------------------------------------------
@@ -361,17 +421,22 @@ RTEMS_LINKER_RWSET_ITEM_REFERENCE - References a read-write linker set item
.. index:: RTEMS_LINKER_RWSET_ITEM_REFERENCE
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_RWSET_ITEM_REFERENCE( set, type, item );
**DESCRIPTION:**
-This macro generates a reference to an item contained in the read-write linker set
-identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set. The ``item`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies an item in the linker set.
+This macro generates a reference to an item contained in the read-write linker
+set identified by ``set``. The ``set`` parameter itself must be a valid C
+designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set. The ``item`` parameter itself must be a valid C designator on which
+no macro expansion is performed. It uniquely identifies an item in the linker
+set.
+
+.. _RTEMS_LINKER_RWSET_ITEM:
RTEMS_LINKER_RWSET_ITEM - Defines a read-write linker set item
--------------------------------------------------------------
@@ -380,17 +445,22 @@ RTEMS_LINKER_RWSET_ITEM - Defines a read-write linker set item
.. index:: RTEMS_LINKER_RWSET_ITEM
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_RWSET_ITEM( set, type, item );
**DESCRIPTION:**
-This macro generates a definition of an item contained in the read-write linker set
-identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set. The ``item`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies an item in the linker set.
+This macro generates a definition of an item contained in the read-write linker
+set identified by ``set``. The ``set`` parameter itself must be a valid C
+designator on which no macro expansion is performed. It uniquely identifies
+the linker set. The ``type`` parameter defines the type of the linker set
+items. The type must be the same for all macro invocations of a particular
+linker set. The ``item`` parameter itself must be a valid C designator on which
+no macro expansion is performed. It uniquely identifies an item in the linker
+set.
+
+.. _RTEMS_LINKER_RWSET_ITEM_ORDERED:
RTEMS_LINKER_RWSET_ITEM_ORDERED - Defines an ordered read-write linker set item
-------------------------------------------------------------------------------
@@ -399,49 +469,48 @@ RTEMS_LINKER_RWSET_ITEM_ORDERED - Defines an ordered read-write linker set item
.. index:: RTEMS_LINKER_RWSET_ITEM_ORDERED
-.. code:: c
+.. code-block:: c
RTEMS_LINKER_RWSET_ITEM_ORDERED( set, type, item, order );
**DESCRIPTION:**
-This macro generates a definition of an ordered item contained in the read-write
-linker set identified by ``set``. The ``set`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies the linker set. The ``type`` parameter defines the type of the linker set items. The type
-must be the same for all macro invocations of a particular linker set.
-The ``item`` parameter itself must be a valid C designator on which no macro
-expansion is performed. It uniquely identifies an item in the linker set. The ``order`` parameter must be a valid linker input section name part on
-which macro expansion is performed. The items are lexicographically ordered
-according to the ``order`` parameter within a linker set. Ordered items are
-placed before unordered items in the linker set.
+This macro generates a definition of an ordered item contained in the
+read-write linker set identified by ``set``. The ``set`` parameter itself must
+be a valid C designator on which no macro expansion is performed. It uniquely
+identifies the linker set. The ``type`` parameter defines the type of the
+linker set items. The type must be the same for all macro invocations of a
+particular linker set. The ``item`` parameter itself must be a valid C
+designator on which no macro expansion is performed. It uniquely identifies an
+item in the linker set. The ``order`` parameter must be a valid linker input
+section name part on which macro expansion is performed. The items are
+lexicographically ordered according to the ``order`` parameter within a linker
+set. Ordered items are placed before unordered items in the linker set.
**NOTES:**
To be resilient to typos in the order parameter, it is recommended to use the
following construct in macros defining items for a particular linker set (see
enum in ``XYZ_ITEM()``).
-.. code:: c
+
+.. code-block:: c
#include <rtems/linkersets.h>
+
typedef struct {
- int foo;
+ int foo;
} xyz_item;
- /* The XYZ-order defines \*/
+
+ /* The XYZ-order defines */
#define XYZ_ORDER_FIRST 0x00001000
#define XYZ_ORDER_AND_SO_ON 0x00002000
- /* Defines an ordered XYZ-item \*/
- #define XYZ_ITEM( item, order ) \\
- enum { xyz_##item = order - order }; \\
- RTEMS_LINKER_RWSET_ITEM_ORDERED( \\
- xyz, const xyz_item \*, item, order \\
- ) = { &item }
- /* Example item \*/
+
+ /* Defines an ordered XYZ-item */
+ #define XYZ_ITEM( item, order ) \
+ enum { xyz_##item = order - order }; \
+ RTEMS_LINKER_RWSET_ITEM_ORDERED( \
+ xyz, const xyz_item \*, item, order \
+ ) = { &item }
+ /* Example item */
static const xyz_item some_item = { 123 };
XYZ_ITEM( some_item, XYZ_ORDER_FIRST );
-
-.. COMMENT: COPYRIGHT (c) 1989-2014.
-
-.. COMMENT: On-Line Applications Research Corporation (OAR).
-
-.. COMMENT: All rights reserved.
-