File indexing completed on 2025-05-11 08:24:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #ifndef _RTEMS_LINKERSET_H
0037 #define _RTEMS_LINKERSET_H
0038
0039 #include <rtems/score/basedefs.h>
0040
0041 #ifdef __cplusplus
0042 extern "C" {
0043 #endif
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 static inline uintptr_t _Linker_set_Obfuscate( const void *ptr )
0056 {
0057 uintptr_t addr;
0058
0059 addr = (uintptr_t) ptr;
0060 RTEMS_OBFUSCATE_VARIABLE( addr );
0061
0062 return addr;
0063 }
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 #define RTEMS_LINKER_SET_BEGIN( set ) \
0076 _Linker_set_##set##_begin
0077
0078 #define RTEMS_LINKER_SET_END( set ) \
0079 _Linker_set_##set##_end
0080
0081
0082
0083
0084
0085
0086 #define RTEMS_LINKER_SET_ALIGN( type ) \
0087 RTEMS_ALIGNED( RTEMS_ALIGNOF( type ) )
0088
0089 #define RTEMS_LINKER_ROSET_DECLARE( set, type ) \
0090 extern RTEMS_LINKER_SET_ALIGN( type ) type \
0091 const RTEMS_LINKER_SET_BEGIN( set )[]; \
0092 extern RTEMS_LINKER_SET_ALIGN( type ) type \
0093 const RTEMS_LINKER_SET_END( set )[]
0094
0095 #define RTEMS_LINKER_ROSET( set, type ) \
0096 RTEMS_LINKER_SET_ALIGN( type ) type const RTEMS_LINKER_SET_BEGIN( set )[ 0 ] \
0097 RTEMS_SECTION( ".rtemsroset." #set ".begin" ) RTEMS_USED; \
0098 RTEMS_LINKER_SET_ALIGN( type ) type const RTEMS_LINKER_SET_END( set )[ 0 ] \
0099 RTEMS_SECTION( ".rtemsroset." #set ".end" ) RTEMS_USED
0100
0101 #define RTEMS_LINKER_ROSET_ITEM_ORDERED_DECLARE( set, type, item, order ) \
0102 extern RTEMS_LINKER_SET_ALIGN( type ) type const _Linker_set_##set##_##item \
0103 RTEMS_SECTION( ".rtemsroset." #set ".content.0." RTEMS_XSTRING( order ) )
0104
0105 #define RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item ) \
0106 extern RTEMS_LINKER_SET_ALIGN( type ) type const _Linker_set_##set##_##item \
0107 RTEMS_SECTION( ".rtemsroset." #set ".content.1" )
0108
0109 #define RTEMS_LINKER_ROSET_ITEM_REFERENCE( set, type, item ) \
0110 static RTEMS_LINKER_SET_ALIGN( type ) type \
0111 const * const _Set_reference_##set##_##item \
0112 RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \
0113 &_Linker_set_##set##_##item
0114
0115 #define RTEMS_LINKER_ROSET_ITEM_ORDERED( set, type, item, order ) \
0116 RTEMS_LINKER_SET_ALIGN( type ) type const _Linker_set_##set##_##item \
0117 RTEMS_SECTION( ".rtemsroset." #set ".content.0." RTEMS_XSTRING( order ) ) \
0118 RTEMS_USED
0119
0120 #define RTEMS_LINKER_ROSET_ITEM( set, type, item ) \
0121 RTEMS_LINKER_SET_ALIGN( type ) type const _Linker_set_##set##_##item \
0122 RTEMS_SECTION( ".rtemsroset." #set ".content.1" ) RTEMS_USED
0123
0124 #define RTEMS_LINKER_ROSET_CONTENT( set, decl ) \
0125 decl \
0126 RTEMS_SECTION( ".rtemsroset." #set ".content" )
0127
0128 #define RTEMS_LINKER_RWSET_DECLARE( set, type ) \
0129 extern RTEMS_LINKER_SET_ALIGN( type ) type RTEMS_LINKER_SET_BEGIN( set )[]; \
0130 extern RTEMS_LINKER_SET_ALIGN( type ) type RTEMS_LINKER_SET_END( set )[]
0131
0132 #define RTEMS_LINKER_RWSET( set, type ) \
0133 RTEMS_LINKER_SET_ALIGN( type ) type RTEMS_LINKER_SET_BEGIN( set )[ 0 ] \
0134 RTEMS_SECTION( ".rtemsrwset." #set ".begin" ) RTEMS_USED; \
0135 RTEMS_LINKER_SET_ALIGN( type ) type RTEMS_LINKER_SET_END( set )[ 0 ] \
0136 RTEMS_SECTION( ".rtemsrwset." #set ".end" ) RTEMS_USED
0137
0138 #define RTEMS_LINKER_RWSET_ITEM_ORDERED_DECLARE( set, type, item, order ) \
0139 extern RTEMS_LINKER_SET_ALIGN( type ) type _Linker_set_##set##_##item \
0140 RTEMS_SECTION( ".rtemsrwset." #set ".content.0." RTEMS_XSTRING( order ) )
0141
0142 #define RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item ) \
0143 extern RTEMS_LINKER_SET_ALIGN( type ) type _Linker_set_##set##_##item \
0144 RTEMS_SECTION( ".rtemsrwset." #set ".content.1" )
0145
0146
0147
0148
0149
0150
0151 #define RTEMS_LINKER_RWSET_ITEM_REFERENCE( set, type, item ) \
0152 static RTEMS_LINKER_SET_ALIGN( type ) type \
0153 * const _Set_reference_##set##_##item \
0154 RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \
0155 &_Linker_set_##set##_##item
0156
0157 #define RTEMS_LINKER_RWSET_ITEM_ORDERED( set, type, item, order ) \
0158 RTEMS_LINKER_SET_ALIGN( type ) type _Linker_set_##set##_##item \
0159 RTEMS_SECTION( ".rtemsrwset." #set ".content.0." RTEMS_XSTRING( order ) ) \
0160 RTEMS_USED
0161
0162 #define RTEMS_LINKER_RWSET_ITEM( set, type, item ) \
0163 RTEMS_LINKER_SET_ALIGN( type ) type _Linker_set_##set##_##item \
0164 RTEMS_SECTION( ".rtemsrwset." #set ".content.1" ) RTEMS_USED
0165
0166 #define RTEMS_LINKER_RWSET_CONTENT( set, decl ) \
0167 decl \
0168 RTEMS_SECTION( ".rtemsrwset." #set ".content" )
0169
0170 #define RTEMS_LINKER_SET_SIZE( set ) \
0171 ( _Linker_set_Obfuscate( RTEMS_LINKER_SET_END( set ) ) \
0172 - _Linker_set_Obfuscate( RTEMS_LINKER_SET_BEGIN( set ) ) )
0173
0174 #define RTEMS_LINKER_SET_ITEM_COUNT( set ) \
0175 ( RTEMS_LINKER_SET_SIZE( set ) \
0176 / sizeof( RTEMS_LINKER_SET_BEGIN( set )[ 0 ] ) )
0177
0178 #define RTEMS_LINKER_SET_IS_EMPTY( set ) \
0179 ( RTEMS_LINKER_SET_SIZE( set ) == 0 )
0180
0181 #define RTEMS_LINKER_SET_FOREACH( set, item ) \
0182 for ( \
0183 item = (void *) _Linker_set_Obfuscate( RTEMS_LINKER_SET_BEGIN( set ) ) ; \
0184 item != RTEMS_LINKER_SET_END( set ) ; \
0185 ++item \
0186 )
0187
0188
0189
0190 #ifdef __cplusplus
0191 }
0192 #endif
0193
0194 #endif