GCC 3.4 doesn't include a #pragma weak reference, if the symbol
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Tue, 1 Feb 2005 22:35:19 +0000 (22:35 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Tue, 1 Feb 2005 22:35:19 +0000 (22:35 +0000)
doesn't exist anyway. This broke the build obviously.
Change the places in libc which used the pragma to use __weak_reference.

lib/libc/gen/_pthread_stubs.c
lib/libc/gen/_spinlock_stub.c
lib/libc/stdio/_flock_stub.c
lib/libc/sys/__error.c

index 0f6341e..94718ad 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: /repoman/r/ncvs/src/lib/libc/gen/_pthread_stubs.c,v 1.1 2001/01/24 12:59:20 deischen Exp $
- * $DragonFly: src/lib/libc/gen/_pthread_stubs.c,v 1.1 2005/01/31 22:29:15 dillon Exp $
+ * $DragonFly: src/lib/libc/gen/_pthread_stubs.c,v 1.2 2005/02/01 22:35:19 joerg Exp $
  */
 
 #include <pthread.h>
  * between application locks and libc locks (threads holding the
  * latter can't be allowed to exit/terminate).
  */
-#pragma weak   _pthread_getspecific=_pthread_getspecific_stub
-#pragma weak   _pthread_key_create=_pthread_key_create_stub
-#pragma weak   _pthread_key_delete=_pthread_key_delete_stub
-#pragma weak   _pthread_mutex_destroy=_pthread_mutex_destroy_stub
-#pragma weak   _pthread_mutex_init=_pthread_mutex_init_stub
-#pragma weak   _pthread_mutex_lock=_pthread_mutex_lock_stub
-#pragma weak   _pthread_mutex_trylock=_pthread_mutex_trylock_stub
-#pragma weak   _pthread_mutex_unlock=_pthread_mutex_unlock_stub
-#pragma weak   _pthread_mutexattr_init=_pthread_mutexattr_init_stub
-#pragma weak   _pthread_mutexattr_destroy=_pthread_mutexattr_destroy_stub
-#pragma weak   _pthread_mutexattr_settype=_pthread_mutexattr_settype_stub
-#pragma weak   _pthread_once=_pthread_once_stub
-#pragma weak   _pthread_setspecific=_pthread_setspecific_stub
-
+__weak_reference(_pthread_getspecific_stub,_pthread_getspecific);
+__weak_reference(_pthread_key_create_stub,_pthread_key_create);
+__weak_reference(_pthread_key_delete_stub,_pthread_key_delete);
+__weak_reference(_pthread_mutex_destroy_stub,_pthread_mutex_destroy);
+__weak_reference(_pthread_mutex_init_stub,_pthread_mutex_init);
+__weak_reference(_pthread_mutex_lock_stub,_pthread_mutex_lock);
+__weak_reference(_pthread_mutex_trylock_stub,_pthread_mutex_trylock);
+__weak_reference(_pthread_mutex_unlock_stub,_pthread_mutex_unlock);
+__weak_reference(_pthread_mutexattr_init_stub,_pthread_mutexattr_init);
+__weak_reference(_pthread_mutexattr_destroy_stub,_pthread_mutexattr_destroy);
+__weak_reference(_pthread_mutexattr_settype_stub,_pthread_mutexattr_settype);
+__weak_reference(_pthread_once_stub,_pthread_once);
+__weak_reference(_pthread_setspecific_stub,_pthread_setspecific);
 
 void *
 _pthread_getspecific_stub(pthread_key_t key)
index 454233e..8ccb92a 100644 (file)
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/lib/libc/gen/_spinlock_stub.c,v 1.4 1999/08/27 23:58:27 peter Exp $
- * $DragonFly: src/lib/libc/gen/_spinlock_stub.c,v 1.4 2005/01/31 22:29:15 dillon Exp $
+ * $DragonFly: src/lib/libc/gen/_spinlock_stub.c,v 1.5 2005/02/01 22:35:19 joerg Exp $
  *
  */
 
  * Declare weak definitions in case the application is not linked
  * with libpthread.
  */
-#pragma weak _atomic_lock=_atomic_lock_stub
-#pragma weak _spinlock=_spinlock_stub
-#pragma weak _spinlock_debug=_spinlock_debug_stub
-#pragma weak _spinunlock=_spinunlock_stub
-
-void   _spinlock(spinlock_t *);
-void   _spinlock_debug(spinlock_t *, char *, int);
+__weak_reference(_atomic_lock_stub,_atomic_lock);
+__weak_reference(_spinlock_stub,_spinlock);
+__weak_reference(_spinlock_debug_stub,_spinlock_debug);
+__weak_reference(_spinunlock_stub,_spinunlock);
 
 /*
  * This function is a stub for the _atomic_lock function in libpthread.
index 83ac6fd..4afe4e1 100644 (file)
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/lib/libc/stdio/_flock_stub.c,v 1.3 1999/08/28 00:00:55 peter Exp $
- * $DragonFly: src/lib/libc/stdio/_flock_stub.c,v 1.4 2005/01/31 22:29:40 dillon Exp $
+ * $DragonFly: src/lib/libc/stdio/_flock_stub.c,v 1.5 2005/02/01 22:35:19 joerg Exp $
  *
  */
 
  * Declare weak references in case the application is not linked
  * with libpthread.
  */
-#pragma weak flockfile=_flockfile_stub
-#pragma weak _flockfile=_flockfile_stub
-#pragma weak _flockfile_debug=_flockfile_debug_stub
-#pragma weak ftrylockfile=_ftrylockfile_stub
-#pragma weak _ftrylockfile=_ftrylockfile_stub
-#pragma weak funlockfile=_funlockfile_stub
-#pragma weak _funlockfile=_funlockfile_stub
+__weak_reference(_flockfile_stub,flockfile);
+__weak_reference(_flockfile_stub,_flockfile);
+__weak_reference(_flockfile_debug_stub,_flockfile_debug);
+__weak_reference(__ftrylockfile_stub,ftrylockfile);
+__weak_reference(_ftrylockfile_stub,_ftrylockfile);
+__weak_reference(_funlockfile_stub,funlockfile);
+__weak_reference(_funlockfile_stub,_funlockfile);
 
 void   flockfile(FILE *);
 void   _flockfile_debug(FILE *, char *, int);
index 7b8f5e7..0731e09 100644 (file)
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/lib/libc/sys/__error.c,v 1.1.8.1 2001/03/05 11:45:51 obrien Exp $
- * $DragonFly: src/lib/libc/sys/Attic/__error.c,v 1.3 2004/01/23 11:30:28 joerg Exp $
+ * $DragonFly: src/lib/libc/sys/Attic/__error.c,v 1.4 2005/02/01 22:35:19 joerg Exp $
  */
 
 #include <sys/cdefs.h>
@@ -41,12 +41,10 @@ extern int errno;
  * Declare a weak reference in case the application is not linked
  * with libpthread.
  */
-#pragma weak __error=__error_unthreaded
-
-int *  __error(void);
+__weak_reference(__error_unthreaded,__error);
 
 int *
-__error_unthreaded()
+__error_unthreaded(void)
 {
        return(&errno);
 }