diff mbox

PR ada/49944 [4.5/4.6/4.7 regression] Bootstrapping on x86_64-pc-kfreebsd-gnu fails with "s-taprop.adb:856:10: "pthread_attr_setaffinity_np" is undefined (more references follow)"

Message ID 87livbra17.fsf@ludovic-brenta.org
State New
Headers show

Commit Message

Ludovic Brenta Aug. 2, 2011, 5:35 p.m. UTC
I think the following patch fixes this problem; it consists only in
copying a few lines from s-osinte-linux.ads to
s-osinte-kfreebsd-gnu.ads:
diff mbox

Patch

Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads
===================================================================
--- a/src/gcc/ada/s-osinte-kfreebsd-gnu.ads
+++ b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads
@@ -469,7 +479,20 @@ 
      (thread     : pthread_t;
       cpusetsize : size_t;
       cpuset     : access cpu_set_t) return int;
-   pragma Import (C, pthread_setaffinity_np, "__gnat_pthread_setaffinity_np");
+   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,
+                    "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
 
Index: b/src/gcc/ada/ChangeLog
===================================================================
--- a/src/gcc/ada/ChangeLog
+++ b/src/gcc/ada/ChangeLog
@@ -0,0 +1,15 @@ 
+2011-08-02  Ludovic Brenta  <ludovic@ludovic-brenta.org>
+
+	PR ada/49944
+	* s-osinte-kfreebsd-gnu.ads (pthread_setaffinity_np): import
+	pthread_setaffinity_np instead of __gnat_pthread_setaffinity_np,
+	which no longer exists; and use a Weak_External reference, like we
+	do on Linux.
+	(pthread_attr_setaffinity_np): new, copy from s-osinte-linux.ads.
+