source: rtems/cpukit/include/rtems/linkersets.h @ 878487b0

5
Last change on this file since 878487b0 was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 4.0 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 RTEMS_LINKER_SET_BEGIN( set ) \
25  _Linker_set_##set##_begin
26
27#define RTEMS_LINKER_SET_END( set ) \
28  _Linker_set_##set##_end
29
30#define RTEMS_LINKER_ROSET_DECLARE( set, type ) \
31  extern type const RTEMS_LINKER_SET_BEGIN( set )[0]; \
32  extern type const RTEMS_LINKER_SET_END( set )[0]
33
34#define RTEMS_LINKER_ROSET( set, type ) \
35  type const RTEMS_LINKER_SET_BEGIN( set )[0] \
36  RTEMS_SECTION( ".rtemsroset." #set ".begin" ) RTEMS_USED; \
37  type const RTEMS_LINKER_SET_END( set )[0] \
38  RTEMS_SECTION( ".rtemsroset." #set ".end" ) RTEMS_USED
39
40#define RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item ) \
41  extern type const _Linker_set_##set##_##item
42
43#define RTEMS_LINKER_ROSET_ITEM_REFERENCE( set, type, item ) \
44  static type const * const _Set_reference_##set##_##item \
45  RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \
46  &_Linker_set_##set##_##item
47
48#define RTEMS_LINKER_ROSET_ITEM_ORDERED( set, type, item, order ) \
49  type const _Linker_set_##set##_##item \
50  RTEMS_SECTION( ".rtemsroset." #set ".content.0." RTEMS_XSTRING( order ) ) \
51  RTEMS_USED
52
53#define RTEMS_LINKER_ROSET_ITEM( set, type, item ) \
54  type const _Linker_set_##set##_##item \
55  RTEMS_SECTION( ".rtemsroset." #set ".content.1" ) RTEMS_USED
56
57#define RTEMS_LINKER_ROSET_CONTENT( set, decl ) \
58  decl \
59  RTEMS_SECTION( ".rtemsroset." #set ".content" )
60
61#define RTEMS_LINKER_RWSET_DECLARE( set, type ) \
62  extern type RTEMS_LINKER_SET_BEGIN( set )[0]; \
63  extern type RTEMS_LINKER_SET_END( set )[0]
64
65#define RTEMS_LINKER_RWSET( set, type ) \
66  type RTEMS_LINKER_SET_BEGIN( set )[0] \
67  RTEMS_SECTION( ".rtemsrwset." #set ".begin" ) RTEMS_USED; \
68  type RTEMS_LINKER_SET_END( set )[0] \
69  RTEMS_SECTION( ".rtemsrwset." #set ".end" ) RTEMS_USED
70
71#define RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item ) \
72  extern type _Linker_set_##set##_##item
73
74/*
75 * The .rtemsroset is here not a typo.  We must ensure that the references are
76 * not a victim of the garbage collection of the linker.  Thus, we place them
77 * in a dedicated area of the RTEMS read-only linker set section.
78 */
79#define RTEMS_LINKER_RWSET_ITEM_REFERENCE( set, type, item ) \
80  static type * const _Set_reference_##set##_##item \
81  RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \
82  &_Linker_set_##set##_##item
83
84#define RTEMS_LINKER_RWSET_ITEM_ORDERED( set, type, item, order ) \
85  type _Linker_set_##set##_##item \
86  RTEMS_SECTION( ".rtemsrwset." #set ".content.0." RTEMS_XSTRING( order ) ) \
87  RTEMS_USED
88
89#define RTEMS_LINKER_RWSET_ITEM( set, type, item ) \
90  type _Linker_set_##set##_##item \
91  RTEMS_SECTION( ".rtemsrwset." #set ".content.1" ) RTEMS_USED
92
93#define RTEMS_LINKER_RWSET_CONTENT( set, decl ) \
94  decl \
95  RTEMS_SECTION( ".rtemsrwset." #set ".content" )
96
97RTEMS_INLINE_ROUTINE uintptr_t _Linker_set_Obfuscate( const void *ptr )
98{
99  uintptr_t addr;
100
101  addr = (uintptr_t) ptr;
102  RTEMS_OBFUSCATE_VARIABLE( addr );
103
104  return addr;
105}
106
107#define RTEMS_LINKER_SET_SIZE( set ) \
108  ( _Linker_set_Obfuscate( RTEMS_LINKER_SET_END( set ) ) \
109    - _Linker_set_Obfuscate( RTEMS_LINKER_SET_BEGIN( set ) ) )
110
111#define RTEMS_LINKER_SET_ITEM_COUNT( set ) \
112  ( RTEMS_LINKER_SET_SIZE( set ) \
113    / sizeof( RTEMS_LINKER_SET_BEGIN( set )[ 0 ] ) )
114
115#define RTEMS_LINKER_SET_IS_EMPTY( set ) \
116  ( RTEMS_LINKER_SET_SIZE( set ) == 0 )
117
118#define RTEMS_LINKER_SET_FOREACH( set, item ) \
119  for ( \
120    item = (void *) _Linker_set_Obfuscate( RTEMS_LINKER_SET_BEGIN( set ) ) ; \
121    item != RTEMS_LINKER_SET_END( set ) ; \
122    ++item \
123  )
124
125#ifdef __cplusplus
126}
127#endif /* __cplusplus */
128
129#endif /* _RTEMS_LINKERSET_H */
Note: See TracBrowser for help on using the repository browser.