aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ruiz <ruiz@adacore.com>2010-10-18 13:54:23 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-18 15:54:23 +0200
commit0ae44446c2b6cd370e212fd94fcb8c261f3ef231 (patch)
treefd8be92505a77963bb3e3da7c663b98880cdba33
parent3fd9f17cdc0903732072cd64349ef14912d9cab0 (diff)
downloadgcc-0ae44446c2b6cd370e212fd94fcb8c261f3ef231.zip
gcc-0ae44446c2b6cd370e212fd94fcb8c261f3ef231.tar.gz
gcc-0ae44446c2b6cd370e212fd94fcb8c261f3ef231.tar.bz2
adaint.c (__gnat_pthread_setaffinity_np, [...]): Remove wrappers, no longer needed.
2010-10-18 Jose Ruiz <ruiz@adacore.com> * adaint.c (__gnat_pthread_setaffinity_np, __gnat_pthread_attr_setaffinity_np): Remove wrappers, no longer needed. * s-osinte-linux.ads (pthread_setaffinity_np, pthread_attr_setaffinity_np): Remove use of wrappers. * s-taprop-linux.adb (Create_Task, Initialize): Restore check to verify whether the affinity functionality is available in the OS. * gcc-interface/utils.c: Set TREE_STATIC on functions only when there are defined. From-SVN: r165635
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/adaint.c46
-rw-r--r--gcc/ada/gcc-interface/utils.c4
-rw-r--r--gcc/ada/s-osinte-linux.ads14
-rw-r--r--gcc/ada/s-taprop-linux.adb14
5 files changed, 33 insertions, 56 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 17c0a46..847bef2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-18 Jose Ruiz <ruiz@adacore.com>
+
+ * adaint.c (__gnat_pthread_setaffinity_np,
+ __gnat_pthread_attr_setaffinity_np): Remove wrappers, no longer needed.
+ * s-osinte-linux.ads (pthread_setaffinity_np,
+ pthread_attr_setaffinity_np): Remove use of wrappers.
+ * s-taprop-linux.adb (Create_Task, Initialize): Restore check to verify
+ whether the affinity functionality is available in the OS.
+ * gcc-interface/utils.c: Set TREE_STATIC on functions only when there
+ are defined.
+
2010-10-18 Robert Dewar <dewar@adacore.com>
* einfo.ads, einfo.adb: Minor reformatting.
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 11f6da0..3f4654f 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3671,50 +3671,4 @@ 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/utils.c b/gcc/ada/gcc-interface/utils.c
index 876556c..9973d27 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -1783,7 +1783,6 @@ create_subprog_decl (tree subprog_name, tree asm_name,
DECL_EXTERNAL (subprog_decl) = extern_flag;
TREE_PUBLIC (subprog_decl) = public_flag;
- TREE_STATIC (subprog_decl) = 1;
TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type);
TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type);
TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type);
@@ -1831,6 +1830,9 @@ begin_subprog_body (tree subprog_decl)
announce_function (subprog_decl);
+ /* This function is being defined. */
+ TREE_STATIC (subprog_decl) = 1;
+
current_function_decl = subprog_decl;
/* Enter a new binding level and show that all the parameters belong to
diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads
index 6dc353d..2ea4963 100644
--- a/gcc/ada/s-osinte-linux.ads
+++ b/gcc/ada/s-osinte-linux.ads
@@ -490,18 +490,20 @@ package System.OS_Interface is
(thread : pthread_t;
cpusetsize : size_t;
cpuset : access cpu_set_t) return int;
- 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.
+ 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.
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,
- "__gnat_pthread_attr_setaffinity_np");
- -- Use a wrapper because this function may be available or not, depending
- -- on the version of the system.
+ "pthread_attr_setaffinity_np");
+ pragma Weak_External (pthread_attr_setaffinity_np);
+ -- Use a weak symbol 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 b3554aa..db6ac9f 100644
--- a/gcc/ada/s-taprop-linux.adb
+++ b/gcc/ada/s-taprop-linux.adb
@@ -851,7 +851,14 @@ package body System.Task_Primitives.Operations is
-- not behaving as expected. Setting the required attributes for the
-- creation of the thread works correctly and it is more appropriate.
- if T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then
+ -- Do nothing if required support not provided by the operating system
+
+ if pthread_attr_setaffinity_np'Address = System.Null_Address then
+ null;
+
+ -- Support is available
+
+ elsif T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then
declare
CPU_Set : aliased cpu_set_t := (bits => (others => False));
begin
@@ -1326,8 +1333,9 @@ package body System.Task_Primitives.Operations is
-- pragma CPU for the environment task
- if Environment_Task.Common.Base_CPU /=
- System.Multiprocessors.Not_A_Specific_CPU
+ if pthread_setaffinity_np'Address /= System.Null_Address
+ and then Environment_Task.Common.Base_CPU /=
+ System.Multiprocessors.Not_A_Specific_CPU
then
declare
CPU_Set : aliased cpu_set_t := (bits => (others => False));