]> granicus.if.org Git - gc/commitdiff
Adjust 'pthread_[un]register_cancel undefined ref' workaround (Pthreads)
authorIvan Maidanski <ivmai@mail.ru>
Sun, 15 Sep 2013 11:04:35 +0000 (15:04 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 15 Sep 2013 11:13:16 +0000 (15:13 +0400)
* misc.c (__pthread_register_cancel, __pthread_unregister_cancel):
Move prototypes to pthread_support.c.
* pthread_support.c (__pthread_unregister_cancel,
__pthread_unregister_cancel): Declare only if
PTHREAD_REGISTER_CANCEL_WEAK_STUBS defined.

misc.c
pthread_support.c

diff --git a/misc.c b/misc.c
index c944e2c3f675959bccdd0d8e9138cea14a484dec..5bc689d5c645b5abae001e8201b35f3b3e07a842 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1918,8 +1918,3 @@ GC_API int GC_CALL GC_get_force_unmap_on_gcollect(void)
 {
     return (int)GC_force_unmap_on_gcollect;
 }
-
-void __pthread_register_cancel() __attribute__ ((weak));
-void __pthread_unregister_cancel() __attribute__ ((weak));
-void __pthread_register_cancel() {}
-void __pthread_unregister_cancel() {}
index 1214ab3a84777b93863fc45950c5048f8a92c2de..d9fbb3cc2ff2b1a3bbb52281d39623b663ff9276 100644 (file)
@@ -1940,4 +1940,12 @@ GC_INNER void GC_notify_all_marker(void)
 
 #endif /* PARALLEL_MARK */
 
+#ifdef PTHREAD_REGISTER_CANCEL_WEAK_STUBS
+  /* Workaround "undefined reference" linkage errors on some targets. */
+  void __pthread_register_cancel() __attribute__((__weak__));
+  void __pthread_unregister_cancel() __attribute__((__weak__));
+  void __pthread_register_cancel() {}
+  void __pthread_unregister_cancel() {}
+#endif
+
 #endif /* GC_PTHREADS */