[PATCH 2/2] Export _NCPUWORDS for Ada

Jan Sommer soja-lists at aries.uberspace.de
Thu Oct 29 21:10:32 UTC 2015


_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
  *
-- 
2.5.0




More information about the devel mailing list