aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ruiz <ruiz@adacore.com>2010-10-18 10:48:36 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-18 12:48:36 +0200
commitee1feb1499a5d8bc83e16906f2359c16443cbda7 (patch)
treebe2d0e8e6399ebd9da97cde4e144b5cab6233d39
parentc68015cdba5bdbea25a16f61561438e490af6a8b (diff)
downloadgcc-ee1feb1499a5d8bc83e16906f2359c16443cbda7.zip
gcc-ee1feb1499a5d8bc83e16906f2359c16443cbda7.tar.gz
gcc-ee1feb1499a5d8bc83e16906f2359c16443cbda7.tar.bz2
adaint.c (__gnat_pthread_setaffinity_np, [...]): Add these wrappers which check the availability of the underlying OS...
2010-10-18 Jose Ruiz <ruiz@adacore.com> * adaint.c (__gnat_pthread_setaffinity_np, __gnat_pthread_attr_setaffinity_np): Add these wrappers which check the availability of the underlying OS functionality before calling. * s-osinte-linux.ads (pthread_setaffinity_np, pthread_attr_setaffinity_np): Call a wrapper instead of the OS function to perform a check of its availability. * s-taprop-linux.adb (Create_Task): Remove the check to verify whether the affinity functionality is available in the OS. Now done in a wrapper * gcc-interface/Makefile.in: Remove vmshandler.asm, unused. * gcc-interface/Make-lang.in: Update dependencies. From-SVN: r165628
-rw-r--r--gcc/ada/ChangeLog13
-rw-r--r--gcc/ada/adaint.c46
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in67
-rw-r--r--gcc/ada/gcc-interface/Makefile.in4
-rw-r--r--gcc/ada/s-osinte-linux.ads12
-rw-r--r--gcc/ada/s-taprop-linux.adb19
6 files changed, 99 insertions, 62 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 83d3e78..b443752 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,16 @@
+2010-10-18 Jose Ruiz <ruiz@adacore.com>
+
+ * adaint.c (__gnat_pthread_setaffinity_np,
+ __gnat_pthread_attr_setaffinity_np): Add these wrappers which check the
+ availability of the underlying OS functionality before calling.
+ * s-osinte-linux.ads (pthread_setaffinity_np,
+ pthread_attr_setaffinity_np): Call a wrapper instead of the OS function
+ to perform a check of its availability.
+ * s-taprop-linux.adb (Create_Task): Remove the check to verify whether
+ the affinity functionality is available in the OS. Now done in a wrapper
+ * gcc-interface/Makefile.in: Remove vmshandler.asm, unused.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
2010-10-18 Robert Dewar <dewar@adacore.com>
* sinfo.ads, sinfo.adb: Change Has_Pragma_CPU to Flag14 (Flag10 is
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 3f4654f..11f6da0 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3671,4 +3671,50 @@ void *__gnat_lwp_self (void)
{
return (void *) syscall (__NR_gettid);
}
+
+/* For the affinity functions, there are systems which do not provide
+ the required support, so we create a wrapper to check its availability
+ before calling. */
+
+extern int pthread_setaffinity_np (pthread_t th,
+ size_t cpusetsize,
+ const void *cpuset)
+ __attribute__((weak));
+
+extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
+ size_t cpusetsize,
+ const void *cpuset)
+ __attribute__((weak));
+
+int __gnat_pthread_setaffinity_np (pthread_t th,
+ size_t cpusetsize,
+ const void *cpuset);
+
+int __gnat_pthread_attr_setaffinity_np (pthread_attr_t *__attr,
+ size_t cpusetsize,
+ const void *cpuset);
+
+int
+__gnat_pthread_setaffinity_np (pthread_t th,
+ size_t cpusetsize,
+ const void *cpuset)
+{
+ /* Call the underlying OS operation if available */
+ if (pthread_setaffinity_np)
+ return pthread_setaffinity_np (th, cpusetsize, cpuset);
+ else
+ return 0;
+}
+
+int
+__gnat_pthread_attr_setaffinity_np (pthread_attr_t *__attr,
+ size_t cpusetsize,
+ const void *cpuset)
+{
+ /* Call the underlying OS operation if available */
+ if (pthread_attr_setaffinity_np)
+ return pthread_attr_setaffinity_np (__attr, cpusetsize, cpuset);
+ else
+ return 0;
+}
#endif
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index aa8403e..561f895 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -190,8 +190,6 @@ GNAT_ADA_OBJS = \
ada/gnatvsn.o \
ada/hlo.o \
ada/hostparm.o \
- ada/i-c.o \
- ada/i-cstrea.o \
ada/impunit.o \
ada/inline.o \
ada/interfac.o \
@@ -2597,16 +2595,6 @@ ada/hostparm.o : ada/ada.ads ada/a-unccon.ads ada/hostparm.ads \
ada/system.ads ada/s-exctab.ads ada/s-stalib.ads ada/s-unstyp.ads \
ada/types.ads ada/unchconv.ads ada/unchdeal.ads
-ada/i-c.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/interfac.ads \
- ada/i-c.ads ada/i-c.adb ada/system.ads ada/s-exctab.ads \
- ada/s-exctab.adb ada/s-htable.ads ada/s-parame.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads
-
-ada/i-cstrea.o : ada/ada.ads ada/a-unccon.ads ada/interfac.ads \
- ada/i-cstrea.ads ada/i-cstrea.adb ada/system.ads ada/s-crtl.ads \
- ada/s-parame.ads
-
ada/impunit.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -3574,20 +3562,21 @@ ada/sem_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_cat.adb ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch3.adb \
ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads \
ada/sem_dist.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb \
- ada/sem_mech.ads ada/sem_res.ads ada/sem_smem.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \
- ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
- ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
- ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/urealp.adb ada/validsw.ads ada/widechar.ads
+ ada/sem_mech.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_smem.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
+ ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \
+ ada/widechar.ads
ada/sem_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3708,19 +3697,19 @@ ada/sem_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch12.ads \
ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads \
ada/sem_ch7.adb ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads \
- ada/sem_prag.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/sinput.adb ada/snames.ads ada/snames.adb \
- ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/sinput.adb ada/snames.ads ada/snames.adb ada/stand.ads \
+ ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 4b64766..602e466 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1566,10 +1566,6 @@ adamsg.o: adamsg.msg
GMEM_LIB = gmemlib
EH_MECHANISM=-gcc
GNATLIB_SHARED=gnatlib-shared-vms
- ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
- EXTRA_LIBGNAT_SRCS=vmshandler.asm
- EXTRA_LIBGNAT_OBJS=vmshandler.o
- endif
EXTRA_LIBGNAT_SRCS+=adamsg.msg
EXTRA_LIBGNAT_OBJS+=adamsg.o
EXTRA_GNATRTL_TASKING_OBJS=s-tpopde.o
diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads
index 6d6a0c4..6dc353d 100644
--- a/gcc/ada/s-osinte-linux.ads
+++ b/gcc/ada/s-osinte-linux.ads
@@ -490,18 +490,18 @@ package System.OS_Interface is
(thread : pthread_t;
cpusetsize : size_t;
cpuset : access cpu_set_t) return int;
- pragma Import (C, pthread_setaffinity_np, "pthread_setaffinity_np");
- pragma Weak_External (pthread_setaffinity_np);
- -- Use a weak symbol because this function may be available or not,
- -- depending on the version of the system.
+ pragma Import (C, pthread_setaffinity_np, "__gnat_pthread_setaffinity_np");
+ -- Use a wrapper because this function may be available or not, depending
+ -- on the version of the system.
function pthread_attr_setaffinity_np
(attr : access pthread_attr_t;
cpusetsize : size_t;
cpuset : access cpu_set_t) return int;
pragma Import (C, pthread_attr_setaffinity_np,
- "pthread_attr_setaffinity_np");
- pragma Weak_External (pthread_attr_setaffinity_np);
+ "__gnat_pthread_attr_setaffinity_np");
+ -- Use a wrapper because this function may be available or not, depending
+ -- on the version of the system.
private
diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb
index 6dcb105..b3554aa 100644
--- a/gcc/ada/s-taprop-linux.adb
+++ b/gcc/ada/s-taprop-linux.adb
@@ -844,21 +844,14 @@ package body System.Task_Primitives.Operations is
(Attributes'Access, PTHREAD_CREATE_DETACHED);
pragma Assert (Result = 0);
- -- We were calling pthread_setaffinity_np (after thread creation but
- -- before thread activation) to set the affinity but it was not
- -- behaving as expected. Now we set the required attributes for the
- -- creation of the thread, which is working correctly and it is
- -- more appropriate.
+ -- Set the required attributes for the creation of the thread
- if pthread_attr_setaffinity_np'Address = System.Null_Address then
+ -- Note: Previously, we called pthread_setaffinity_np (after thread
+ -- creation but before thread activation) to set the affinity but it was
+ -- not behaving as expected. Setting the required attributes for the
+ -- creation of the thread works correctly and it is more appropriate.
- -- Nothing to do with the affinities if no underlying support
-
- null;
-
- -- Handle pragma CPU
-
- elsif T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then
+ if T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then
declare
CPU_Set : aliased cpu_set_t := (bits => (others => False));
begin