[rtems commit] linkersets: Revert to zero-length arrays

Sebastian Huber sebh at rtems.org
Mon Nov 25 10:45:28 UTC 2019


Module:    rtems
Branch:    master
Commit:    234d155e879d7ca72fa5dd9d29a8347fa294676e
Changeset: http://git.rtems.org/rtems/commit/?id=234d155e879d7ca72fa5dd9d29a8347fa294676e

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Nov 25 10:39:19 2019 +0100

linkersets: Revert to zero-length arrays

This partially reverts commit 7ec08391fee73d7a25855089f4996f3c4f448007.

Since the RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION() cannot control the
alignment of the symbol it cannot be used to define the begin of a
linker set.  File scope basic __asm__ statements cannot have operands,
so there is no way to specify the desired alignment.

---

 cpukit/include/rtems/linkersets.h | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/cpukit/include/rtems/linkersets.h b/cpukit/include/rtems/linkersets.h
index 4a23d7a..6146703 100644
--- a/cpukit/include/rtems/linkersets.h
+++ b/cpukit/include/rtems/linkersets.h
@@ -32,15 +32,10 @@ extern "C" {
   extern type const RTEMS_LINKER_SET_END( set )[]
 
 #define RTEMS_LINKER_ROSET( set, type ) \
-  RTEMS_LINKER_ROSET_DECLARE( set, type ); \
-  RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( \
-    RTEMS_LINKER_SET_BEGIN( set ), \
-    ".rtemsroset." #set ".begin" \
-  ); \
-  RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( \
-    RTEMS_LINKER_SET_END( set ), \
-    ".rtemsroset." #set ".end" \
-  )
+  type const RTEMS_LINKER_SET_BEGIN( set )[ 0 ] \
+  RTEMS_SECTION( ".rtemsroset." #set ".begin" ) RTEMS_USED; \
+  type const RTEMS_LINKER_SET_END( set )[ 0 ] \
+  RTEMS_SECTION( ".rtemsroset." #set ".end" ) RTEMS_USED
 
 #define RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item ) \
   extern type const _Linker_set_##set##_##item
@@ -68,15 +63,10 @@ extern "C" {
   extern type RTEMS_LINKER_SET_END( set )[]
 
 #define RTEMS_LINKER_RWSET( set, type ) \
-  RTEMS_LINKER_RWSET_DECLARE( set, type ); \
-  RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( \
-    RTEMS_LINKER_SET_BEGIN( set ), \
-    ".rtemsrwset." #set ".begin" \
-  ); \
-  RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( \
-    RTEMS_LINKER_SET_END( set ), \
-    ".rtemsrwset." #set ".end" \
-  )
+  type RTEMS_LINKER_SET_BEGIN( set )[ 0 ] \
+  RTEMS_SECTION( ".rtemsrwset." #set ".begin" ) RTEMS_USED; \
+  type RTEMS_LINKER_SET_END( set )[ 0 ] \
+  RTEMS_SECTION( ".rtemsrwset." #set ".end" ) RTEMS_USED
 
 #define RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item ) \
   extern type _Linker_set_##set##_##item



More information about the vc mailing list