[RTEMS Project] #4953: Definition of _ISR_Stack_size may not work for some code models

RTEMS trac trac at rtems.org
Tue Sep 12 13:48:38 UTC 2023


#4953: Definition of _ISR_Stack_size may not work for some code models
------------------------------+-----------------------------
  Reporter:  Sebastian Huber  |      Owner:  Sebastian Huber
      Type:  defect           |     Status:  assigned
  Priority:  normal           |  Milestone:  6.1
 Component:  score            |    Version:  6
  Severity:  normal           |   Keywords:  qualification
Blocked By:                   |   Blocking:
------------------------------+-----------------------------
 The _ISR_Stack_size is defined by the application configuration like this:
 {{{#!c
 /**
  * @ingroup RTEMSAPIBaseDefs
  *
  * @brief Defines a global symbol with the name and value.
  *
  * @param _name is the user defined name of the symbol.  The name shall be
 a
  *   valid designator.  On the name a macro expansion is performed and
  *   afterwards it is stringified.
  *
  * @param _value is the value of the symbol.  On the value a macro
 expansion is
  *   performed and afterwards it is stringified.  It shall expand to an
 integer
  *   expression understood by the assembler.
  *
  * This macro shall be placed at file scope.
  */
 #if defined(__USER_LABEL_PREFIX__)
   #define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value ) \
     __asm__( \
       "\t.globl " RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) \
       "\n\t.set " RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) \
       ", " RTEMS_STRING( _value ) "\n" \
     )
 #else
   #define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value )
 #endif

 RTEMS_DEFINE_GLOBAL_SYMBOL(
   _ISR_Stack_size,
   CONFIGURE_INTERRUPT_STACK_SIZE
 );
 }}}

 Firstly, the RTEMS_DEFINE_GLOBAL_SYMBOL() is broken. It should depend on
 __GNUC__ and not __USER_LABEL_PREFIX__.

 Secondly, setting a symbol to an arbitrary absolute address may not work
 with all code models, see:

 https://sourceware.org/pipermail/binutils/2023-September/129448.html

 The _ISR_Stack_size should be changed to point to the end of the ISR stack
 of processor 0:

 {{{
 RTEMS_DEFINE_GLOBAL_SYMBOL(
   _ISR_Stack_0_end,
   RTEMS_SYMBOL_NAME( _ISR_Stack_area_begin )
     + CONFIGURE_INTERRUPT_STACK_SIZE
 );
 }}}

 The tests for RTEMS_DEFINE_GLOBAL_SYMBOL() should be changed to use values
 relative to another symbol.

--
Ticket URL: <http://devel.rtems.org/ticket/4953>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list