From 795b167545ac074509f4b7c5fd7ed1c0da717460 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 4 Oct 2019 08:51:13 +0200 Subject: score: Add RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION() Update #3799. --- cpukit/include/rtems/score/basedefs.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cpukit/include/rtems/score/basedefs.h') diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h index 782958920c..5f38559b6d 100644 --- a/cpukit/include/rtems/score/basedefs.h +++ b/cpukit/include/rtems/score/basedefs.h @@ -343,6 +343,25 @@ #define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value ) #endif +/** + * @brief Defines a global symbol with the specified name in the specified + * section. + * + * The name must be a valid designator. + */ +#if defined(__GNUC__) + #define RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( _name, _section ) \ + __asm__( \ + ".pushsection \"" _section "\"\n" \ + "\t.globl " \ + RTEMS_XSTRING( RTEMS_XCONCAT( __USER_LABEL_PREFIX__, _name ) ) "\n" \ + RTEMS_XSTRING( RTEMS_XCONCAT( __USER_LABEL_PREFIX__, _name ) ) ":\n" \ + "\t.popsection\n" \ + ) +#else + #define RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( _name, section ) +#endif + /** * @brief Returns the value of the specified integral expression and tells the * compiler that the predicted value is true (1). -- cgit v1.2.3