diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-09-23 06:45:07 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-10-12 11:12:40 +0200 |
commit | be573185e6d6ddafdd3612c7c2db04aa0f65a330 (patch) | |
tree | 79bf4b932c187c11591a8e4fe0134db0ac9317a7 /cpukit/score/include/rtems/linkersets.h | |
parent | score: Add RTEMS_OBFUSCATE_POINTER() (diff) | |
download | rtems-be573185e6d6ddafdd3612c7c2db04aa0f65a330.tar.bz2 |
score: More robust linker sets
Update #2408.
Update #2790.
Diffstat (limited to 'cpukit/score/include/rtems/linkersets.h')
-rw-r--r-- | cpukit/score/include/rtems/linkersets.h | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/cpukit/score/include/rtems/linkersets.h b/cpukit/score/include/rtems/linkersets.h index 47c210db32..b790fa5c24 100644 --- a/cpukit/score/include/rtems/linkersets.h +++ b/cpukit/score/include/rtems/linkersets.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 embedded brains GmbH. All rights reserved. + * Copyright (c) 2015, 2016 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -21,40 +21,52 @@ extern "C" { #endif /* __cplusplus */ -#define RTEMS_LINKER_SET_BEGIN( set ) \ +#define _LINKER_SET_BEGIN( set ) \ _Linker_set_##set##_begin -#define RTEMS_LINKER_SET_END( set ) \ +#define _LINKER_SET_END( set ) \ _Linker_set_##set##_end +#define RTEMS_LINKER_SET_ASSIGN_BEGIN( set, item ) \ + do { \ + item = _LINKER_SET_BEGIN( set ); \ + RTEMS_OBFUSCATE_POINTER( item ); \ + } while ( 0 ) + +#define RTEMS_LINKER_SET_ASSIGN_END( set, item ) \ + do { \ + item = _LINKER_SET_END( set ); \ + RTEMS_OBFUSCATE_POINTER( item ); \ + } while ( 0 ) + #define RTEMS_LINKER_SET_SIZE( set ) \ ( (size_t) ( _Linker_set_##set##_end - _Linker_set_##set##_begin ) ) #define RTEMS_LINKER_ROSET_DECLARE( set, type ) \ - extern type volatile const RTEMS_LINKER_SET_BEGIN( set )[0]; \ - extern type volatile const RTEMS_LINKER_SET_END( set )[0] + extern type const _LINKER_SET_BEGIN( set )[0]; \ + extern type const _LINKER_SET_END( set )[0] #define RTEMS_LINKER_ROSET( set, type ) \ - type volatile const RTEMS_LINKER_SET_BEGIN( set )[0] \ + type const _LINKER_SET_BEGIN( set )[0] \ RTEMS_SECTION( ".rtemsroset." #set ".begin" ) RTEMS_USED; \ - type volatile const RTEMS_LINKER_SET_END( set )[0] \ + type const _LINKER_SET_END( set )[0] \ RTEMS_SECTION( ".rtemsroset." #set ".end" ) RTEMS_USED #define RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item ) \ - extern type volatile const _Linker_set_##set##_##item + extern type const _Linker_set_##set##_##item #define RTEMS_LINKER_ROSET_ITEM_REFERENCE( set, type, item ) \ - static type volatile const * const _Set_reference_##set##_##item \ + static type const * const _Set_reference_##set##_##item \ RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \ &_Linker_set_##set##_##item #define RTEMS_LINKER_ROSET_ITEM_ORDERED( set, type, item, order ) \ - type volatile const _Linker_set_##set##_##item \ + type const _Linker_set_##set##_##item \ RTEMS_SECTION( ".rtemsroset." #set ".content.0." RTEMS_XSTRING( order ) ) \ RTEMS_USED #define RTEMS_LINKER_ROSET_ITEM( set, type, item ) \ - type volatile const _Linker_set_##set##_##item \ + type const _Linker_set_##set##_##item \ RTEMS_SECTION( ".rtemsroset." #set ".content.1" ) RTEMS_USED #define RTEMS_LINKER_ROSET_CONTENT( set, decl ) \ @@ -62,17 +74,17 @@ extern "C" { RTEMS_SECTION( ".rtemsroset." #set ".content" ) #define RTEMS_LINKER_RWSET_DECLARE( set, type ) \ - extern type volatile RTEMS_LINKER_SET_BEGIN( set )[0]; \ - extern type volatile RTEMS_LINKER_SET_END( set )[0] + extern type _LINKER_SET_BEGIN( set )[0]; \ + extern type _LINKER_SET_END( set )[0] #define RTEMS_LINKER_RWSET( set, type ) \ - type volatile RTEMS_LINKER_SET_BEGIN( set )[0] \ + type _LINKER_SET_BEGIN( set )[0] \ RTEMS_SECTION( ".rtemsrwset." #set ".begin" ) RTEMS_USED; \ - type volatile RTEMS_LINKER_SET_END( set )[0] \ + type _LINKER_SET_END( set )[0] \ RTEMS_SECTION( ".rtemsrwset." #set ".end" ) RTEMS_USED #define RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item ) \ - extern type volatile _Linker_set_##set##_##item + extern type _Linker_set_##set##_##item /* * The .rtemsroset is here not a typo. We must ensure that the references are @@ -80,17 +92,17 @@ extern "C" { * in a dedicated area of the RTEMS read-only linker set section. */ #define RTEMS_LINKER_RWSET_ITEM_REFERENCE( set, type, item ) \ - static type volatile * const _Set_reference_##set##_##item \ + static type * const _Set_reference_##set##_##item \ RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \ &_Linker_set_##set##_##item #define RTEMS_LINKER_RWSET_ITEM_ORDERED( set, type, item, order ) \ - type volatile _Linker_set_##set##_##item \ + type _Linker_set_##set##_##item \ RTEMS_SECTION( ".rtemsrwset." #set ".content.0." RTEMS_XSTRING( order ) ) \ RTEMS_USED #define RTEMS_LINKER_RWSET_ITEM( set, type, item ) \ - type volatile _Linker_set_##set##_##item \ + type _Linker_set_##set##_##item \ RTEMS_SECTION( ".rtemsrwset." #set ".content.1" ) RTEMS_USED #define RTEMS_LINKER_RWSET_CONTENT( set, decl ) \ |