[PATCH 2/2] Export _NCPUWORDS for Ada

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Oct 30 06:50:16 UTC 2015


How is this tackled in the glibc/Linux support? Is the exact layout of 
the structures really interesting for Ada? I guess its sufficient to 
tell Ada the size and alignment of pthread_attr_t for example.

On 29/10/15 22:10, Jan Sommer wrote:
> _NCPUWORDS is defined in newlib in newlib/libc/sys/rtems/sys/cpuset.h and used to define the type cpu_set_t there.
> typedef struct _cpuset {
>    cpu_set_word_t __bits[_NCPUWORDS];
> } cpu_set_t;
> cpu_set_t is used for a field in the struct pthread_attr_t in file newlib/libc/include/types.h
>
> The Gnat Ada runtime uses POSIX-threads for tasking, therefore the pthread-types have to be declared in Ada in order to import them.
> As the fixed size array in cpu_set_t depends on the value of _NCPUWORDS it is exported with the symbol _ada_ncpuwords in order to access it from within the Ada runtime.
>
> The Ada declaration of pthread_attr_t is located in gcc/ada/s-osinte-rtems.ads and _ada_ncpuwords is imported there.
> ---
>   cpukit/libgnat/adasupp.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/cpukit/libgnat/adasupp.c b/cpukit/libgnat/adasupp.c
> index 662b1cc..cde36b6 100644
> --- a/cpukit/libgnat/adasupp.c
> +++ b/cpukit/libgnat/adasupp.c
> @@ -10,6 +10,10 @@
>   #include <rtems/posix/pthreadimpl.h>
>   #include <rtems/score/stackimpl.h>
>   
> +
> +/* export _NCPUWORDS for Ada */
> +const size_t _ada_ncpuwords = _NCPUWORDS - 1;
> +
>   /*
>    *  _ada_pthread_minimum_stack_size
>    *

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list