[PATCH] Add RTEMS linker sets

Chris Johns chrisj at rtems.org
Wed Oct 14 21:16:37 UTC 2015


Hi,

This looks good.

Is this for users or the kernel or both?

Is there any documentation for using this?

On 14/10/2015 9:16 pm, Sebastian Huber wrote:
> --- /dev/null
> +++ b/cpukit/score/include/rtems/score/linkerset.h
> @@ -0,0 +1,76 @@
> +/*
> + * Copyright (c) 2015 embedded brains GmbH.  All rights reserved.
> + *
> + *  embedded brains GmbH
> + *  Dornierstr. 4
> + *  82178 Puchheim
> + *  Germany
> + *  <rtems at embedded-brains.de>
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + * http://www.rtems.org/license/LICENSE.
> + */
> +
> +#ifndef _RTEMS_SCORE_LINKERSET_H
> +#define _RTEMS_SCORE_LINKERSET_H
> +
> +#include <rtems/score/basedefs.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif /* __cplusplus */
> +
> +#define RTEMS_LINKER_SET_BEGIN( set ) \
> +  _Set_##set##_begin

What about prefixing with '_RTEMS_' or '_rtems_'? It makes finding the
symbols for RTEMS easier, eg .... | grep rtems.

Chris

> +
> +#define RTEMS_LINKER_SET_END( set ) \
> +  _Set_##set##_end
> +
> +#define RTEMS_LINKER_SET_SIZE( set ) \
> +  ( (size_t) ( _Set_##set##_end - _Set_##set##_begin ) )
> +
> +#define RTEMS_LINKER_ROSET_DEFINE( set, type ) \
> +  type volatile const RTEMS_LINKER_SET_BEGIN( set )[0] \
> +  RTEMS_SECTION( ".rtemsroset." #set ".begin" ) RTEMS_USED; \
> +  type volatile const RTEMS_LINKER_SET_END( set )[0] \
> +  RTEMS_SECTION( ".rtemsroset." #set ".end" ) RTEMS_USED
> +
> +#define RTEMS_LINKER_ROSET_DECLARE( set, type ) \
> +  extern type volatile const RTEMS_LINKER_SET_BEGIN( set )[0]; \
> +  extern type volatile const RTEMS_LINKER_SET_END( set )[0]
> +
> +#define RTEMS_LINKER_ROSET_ITEM_ORDERED( set, type, item, order ) \
> +  static type const _Set_##set##_##item \
> +  RTEMS_SECTION( ".rtemsroset." #set ".content.0." RTEMS_XSTRING( order ) ) \
> +  RTEMS_USED
> +
> +#define RTEMS_LINKER_ROSET_ITEM( set, type, item ) \
> +  static type const _Set_##set##_##item \
> +  RTEMS_SECTION( ".rtemsroset." #set ".content.1." ) RTEMS_USED
> +
> +#define RTEMS_LINKER_RWSET_DEFINE( set, type ) \
> +  type volatile RTEMS_LINKER_SET_BEGIN( set )[0] \
> +  RTEMS_SECTION( ".rtemsrwset." #set ".begin" ) RTEMS_USED; \
> +  type volatile RTEMS_LINKER_SET_END( set )[0] \
> +  RTEMS_SECTION( ".rtemsrwset." #set ".end" ) RTEMS_USED
> +
> +#define RTEMS_LINKER_RWSET_DECLARE( set, type ) \
> +  extern type volatile RTEMS_LINKER_SET_BEGIN( set )[0]; \
> +  extern type volatile RTEMS_LINKER_SET_END( set )[0]
> +
> +#define RTEMS_LINKER_RWSET_ITEM_ORDERED( set, type, item, order ) \
> +  static type const _Set_##set##_##item \
> +  RTEMS_SECTION( ".rtemsrwset." #set ".content.0." RTEMS_XSTRING( order ) ) \
> +  RTEMS_USED
> +
> +#define RTEMS_LINKER_RWSET_ITEM( set, type, item ) \
> +  static type const _Set_##set##_##item \
> +  RTEMS_SECTION( ".rtemsrwset." #set ".content.1." ) RTEMS_USED
> +
> +#ifdef __cplusplus
> +}
> +#endif /* __cplusplus */
> +
> +#endif /* _RTEMS_SCORE_LINKERSET_H */
> +



More information about the devel mailing list