[PATCH 1/2] score: Add and use RTEMS_SYMBOL_NAME()
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Apr 6 17:57:46 UTC 2020
Update #3799.
---
cpukit/include/rtems/score/basedefs.h | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h
index 4589bea4aa..a2eb14a642 100644
--- a/cpukit/include/rtems/score/basedefs.h
+++ b/cpukit/include/rtems/score/basedefs.h
@@ -321,6 +321,19 @@
#define RTEMS_DECLARE_GLOBAL_SYMBOL( _name ) \
extern char _name[]
+/**
+ * @brief Constructs a symbol name.
+ *
+ * @param _name The user defined name of the symbol. The name must be a valid
+ * designator. On the name a macro expansion is performed.
+ */
+#if defined(__USER_LABEL_PREFIX__)
+ #define RTEMS_SYMBOL_NAME( _name ) RTEMS_XCONCAT( __USER_LABEL_PREFIX__, _name )
+#else
+ #define _RTEMS_SYMBOL_NAME( _name ) _name
+ #define RTEMS_SYMBOL_NAME( _name ) _RTEMS_SYMBOL_NAME( _name )
+#endif
+
/**
* @brief Defines a global symbol with the specified name and value.
*
@@ -335,8 +348,8 @@
#if defined(__GNUC__)
#define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value ) \
__asm__( \
- "\t.globl " RTEMS_XSTRING( __USER_LABEL_PREFIX__ ) #_name \
- "\n\t.set " RTEMS_XSTRING( __USER_LABEL_PREFIX__ ) #_name \
+ "\t.globl " RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) \
+ "\n\t.set " RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) \
", " RTEMS_STRING( _value ) "\n" \
)
#else
@@ -355,8 +368,8 @@
__asm__( \
".pushsection \"" _section "\"\n" \
"\t.globl " \
- RTEMS_XSTRING( RTEMS_XCONCAT( __USER_LABEL_PREFIX__, _name ) ) "\n" \
- RTEMS_XSTRING( RTEMS_XCONCAT( __USER_LABEL_PREFIX__, _name ) ) ":\n" \
+ RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) "\n" \
+ RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) ":\n" \
"\t.popsection\n" \
)
#else
--
2.16.4
More information about the devel
mailing list