source: rtems/cpukit/score/include/rtems/linkersets.h @ f5eff00

5
Last change on this file since f5eff00 was f5eff00, checked in by Sebastian Huber <sebastian.huber@…>, on 10/13/16 at 05:09:49

score: Rename RTEMS_OBFUSCATE_POINTER()

The inline asm construct works for everything which fits into a
register.

Close #2790.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * Copyright (c) 2015, 2016 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifndef _RTEMS_LINKERSET_H
16#define _RTEMS_LINKERSET_H
17
18#include <rtems/score/basedefs.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif /* __cplusplus */
23
24#define _LINKER_SET_BEGIN( set ) \
25  _Linker_set_##set##_begin
26
27#define _LINKER_SET_END( set ) \
28  _Linker_set_##set##_end
29
30#define RTEMS_LINKER_SET_ASSIGN_BEGIN( set, item ) \
31  do { \
32    item = _LINKER_SET_BEGIN( set ); \
33    RTEMS_OBFUSCATE_VARIABLE( item ); \
34  } while ( 0 )
35
36#define RTEMS_LINKER_SET_ASSIGN_END( set, item ) \
37  do { \
38    item = _LINKER_SET_END( set ); \
39    RTEMS_OBFUSCATE_VARIABLE( item ); \
40  } while ( 0 )
41
42#define RTEMS_LINKER_SET_SIZE( set ) \
43  ( (size_t) ( _Linker_set_##set##_end - _Linker_set_##set##_begin ) )
44
45#define RTEMS_LINKER_ROSET_DECLARE( set, type ) \
46  extern type const _LINKER_SET_BEGIN( set )[0]; \
47  extern type const _LINKER_SET_END( set )[0]
48
49#define RTEMS_LINKER_ROSET( set, type ) \
50  type const _LINKER_SET_BEGIN( set )[0] \
51  RTEMS_SECTION( ".rtemsroset." #set ".begin" ) RTEMS_USED; \
52  type const _LINKER_SET_END( set )[0] \
53  RTEMS_SECTION( ".rtemsroset." #set ".end" ) RTEMS_USED
54
55#define RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item ) \
56  extern type const _Linker_set_##set##_##item
57
58#define RTEMS_LINKER_ROSET_ITEM_REFERENCE( set, type, item ) \
59  static type const * const _Set_reference_##set##_##item \
60  RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \
61  &_Linker_set_##set##_##item
62
63#define RTEMS_LINKER_ROSET_ITEM_ORDERED( set, type, item, order ) \
64  type const _Linker_set_##set##_##item \
65  RTEMS_SECTION( ".rtemsroset." #set ".content.0." RTEMS_XSTRING( order ) ) \
66  RTEMS_USED
67
68#define RTEMS_LINKER_ROSET_ITEM( set, type, item ) \
69  type const _Linker_set_##set##_##item \
70  RTEMS_SECTION( ".rtemsroset." #set ".content.1" ) RTEMS_USED
71
72#define RTEMS_LINKER_ROSET_CONTENT( set, decl ) \
73  decl \
74  RTEMS_SECTION( ".rtemsroset." #set ".content" )
75
76#define RTEMS_LINKER_RWSET_DECLARE( set, type ) \
77  extern type _LINKER_SET_BEGIN( set )[0]; \
78  extern type _LINKER_SET_END( set )[0]
79
80#define RTEMS_LINKER_RWSET( set, type ) \
81  type _LINKER_SET_BEGIN( set )[0] \
82  RTEMS_SECTION( ".rtemsrwset." #set ".begin" ) RTEMS_USED; \
83  type _LINKER_SET_END( set )[0] \
84  RTEMS_SECTION( ".rtemsrwset." #set ".end" ) RTEMS_USED
85
86#define RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item ) \
87  extern type _Linker_set_##set##_##item
88
89/*
90 * The .rtemsroset is here not a typo.  We must ensure that the references are
91 * not a victim of the garbage collection of the linker.  Thus, we place them
92 * in a dedicated area of the RTEMS read-only linker set section.
93 */
94#define RTEMS_LINKER_RWSET_ITEM_REFERENCE( set, type, item ) \
95  static type * const _Set_reference_##set##_##item \
96  RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \
97  &_Linker_set_##set##_##item
98
99#define RTEMS_LINKER_RWSET_ITEM_ORDERED( set, type, item, order ) \
100  type _Linker_set_##set##_##item \
101  RTEMS_SECTION( ".rtemsrwset." #set ".content.0." RTEMS_XSTRING( order ) ) \
102  RTEMS_USED
103
104#define RTEMS_LINKER_RWSET_ITEM( set, type, item ) \
105  type _Linker_set_##set##_##item \
106  RTEMS_SECTION( ".rtemsrwset." #set ".content.1" ) RTEMS_USED
107
108#define RTEMS_LINKER_RWSET_CONTENT( set, decl ) \
109  decl \
110  RTEMS_SECTION( ".rtemsrwset." #set ".content" )
111
112#ifdef __cplusplus
113}
114#endif /* __cplusplus */
115
116#endif /* _RTEMS_LINKERSET_H */
Note: See TracBrowser for help on using the repository browser.