From f5eff007a44ad20c2a420b66903508e9d6c3b066 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 13 Oct 2016 07:09:49 +0200 Subject: score: Rename RTEMS_OBFUSCATE_POINTER() The inline asm construct works for everything which fits into a register. Close #2790. --- cpukit/score/include/rtems/linkersets.h | 4 ++-- cpukit/score/include/rtems/score/basedefs.h | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cpukit/score/include/rtems/linkersets.h b/cpukit/score/include/rtems/linkersets.h index b790fa5c24..390d2cba34 100644 --- a/cpukit/score/include/rtems/linkersets.h +++ b/cpukit/score/include/rtems/linkersets.h @@ -30,13 +30,13 @@ extern "C" { #define RTEMS_LINKER_SET_ASSIGN_BEGIN( set, item ) \ do { \ item = _LINKER_SET_BEGIN( set ); \ - RTEMS_OBFUSCATE_POINTER( item ); \ + RTEMS_OBFUSCATE_VARIABLE( item ); \ } while ( 0 ) #define RTEMS_LINKER_SET_ASSIGN_END( set, item ) \ do { \ item = _LINKER_SET_END( set ); \ - RTEMS_OBFUSCATE_POINTER( item ); \ + RTEMS_OBFUSCATE_VARIABLE( item ); \ } while ( 0 ) #define RTEMS_LINKER_SET_SIZE( set ) \ diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h index ea4d8314ce..d142163e91 100644 --- a/cpukit/score/include/rtems/score/basedefs.h +++ b/cpukit/score/include/rtems/score/basedefs.h @@ -222,13 +222,15 @@ #endif /** - * @brief Obfuscates the pointer so that the compiler cannot perform - * optimizations based on the pointer value. + * @brief Obfuscates the variable so that the compiler cannot perform + * optimizations based on the variable value. + * + * The variable must be simple enough to fit into a register. */ #if defined(__GNUC__) - #define RTEMS_OBFUSCATE_POINTER( _ptr ) __asm__("" : "+r" (_ptr)) + #define RTEMS_OBFUSCATE_VARIABLE( _var ) __asm__("" : "+r" (_var)) #else - #define RTEMS_OBFUSCATE_POINTER( _ptr ) (void) (_ptr) + #define RTEMS_OBFUSCATE_VARIABLE( _var ) (void) (_var) #endif #if __cplusplus >= 201103L -- cgit v1.2.3